相同的Neo4j查询不适用于jdbc

时间:2016-11-25 22:38:54

标签: java jdbc neo4j

在我的本地主机上的Neo4j上玩,我构造了这个查询以在'true'和'false'之间切换节点属性'Active'

我在浏览器中执行时效果很好但是当我使用JDBC将它放在我的java类中时,结果是无。

String query = "MATCH (i:Item) "
             + "WHERE id(i)=? "
             + "SET i.active = NOT i.active";

PreparedStatement ps = con.prepareStatement(query);
ps.setInt(1, id);

int updates = ps.executeUpdate();

1 个答案:

答案 0 :(得分:1)

您的查询应更改如下。您应该在{}

中定义参数
- (CVPixelBufferRef) copyPixelbuffer : (CVPixelBufferRef)pixel {

NSAssert(CFGetTypeID(pixel) == CVPixelBufferGetTypeID(), @"typeid !=");
CVPixelBufferRef _copy = NULL;

CVPixelBufferCreate(nil, CVPixelBufferGetWidth(pixel), CVPixelBufferGetHeight(pixel), CVPixelBufferGetPixelFormatType(pixel), CVBufferGetAttachments(pixel, kCVAttachmentMode_ShouldPropagate), &_copy);

if (_copy != NULL) {
    CVPixelBufferLockBaseAddress(pixel, kCVPixelBufferLock_ReadOnly);
    CVPixelBufferLockBaseAddress(_copy, 0);
    size_t count =  CVPixelBufferGetPlaneCount(pixel);
    size_t img_widstp = CVPixelBufferGetBytesPerRowOfPlane(pixel, 0);
    size_t img_heistp = CVPixelBufferGetBytesPerRowOfPlane(pixel, 1);
    NSLog(@"img_widstp = %d, img_heistp = %d", img_widstp, img_heistp);
    for (size_t plane = 0; plane < count; plane++) {
        void *dest = CVPixelBufferGetBaseAddressOfPlane(_copy, plane);
        void *source = CVPixelBufferGetBaseAddressOfPlane(pixel, plane);
        size_t height = CVPixelBufferGetHeightOfPlane(pixel, plane);
        size_t bytesPerRow = CVPixelBufferGetBytesPerRowOfPlane(pixel, plane);

        memcpy(dest, source, height * bytesPerRow);
    }

    CVPixelBufferUnlockBaseAddress(_copy, 0);
    CVPixelBufferUnlockBaseAddress(pixel, kCVPixelBufferLock_ReadOnly);
}
return _copy;
}

因为你没有返回任何东西,你得到的返回值为0. executeUpdate()返回语句的行计数或0表示不返回任何语句的语句。