从C ++ libneo4j_client中的参数化语句获取结果

时间:2018-11-20 08:36:55

标签: c++ libneo4j-client

这是关于从参数化查询中获取数据的follow up question。考虑以下代码:

const char *neo4j_query = "MATCH (p:Person) WHERE p.age > {age} RETURN p.name AS name, p.age as AGE";
neo4j_map_entry_t map_entry = neo4j_map_entry("age", 28);
neo4j_value_t params = neo4j_map(&map_entry, 1);
neo4j_run(session, q, params);

当我尝试使用以下方法获取数据时:

neo4j_result_stream_t *results = neo4j_run( session, neo4j_query, params);
if (results == NULL)
{
    neo4j_perror(stderr, errno, "Failed to run statement");
    printf( "%s\t%s\n", move_details->move, neo4j_query);
    return EXIT_FAILURE;
}

neo4j_result_t *result = neo4j_fetch_next(results);
if (result == NULL)
{
    neo4j_perror(stderr, errno, "Failed to fetch result");
    return EXIT_FAILURE;
}

我收到以下消息

Failed to fetch result: Success

问题是是否有任何特殊的方法来获取结果?

1 个答案:

答案 0 :(得分:0)

根据documentation,从NULL返回的neo4j_fetch_next(...)意味着流中没有(更多)结果-也许查询没有结果?