MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _AST_parse_result_root

Function _AST_parse_result_root

src/ast/ast.c:70–86  ·  view source on GitHub ↗

this function returns the actual root of the query as cypher_parse_result_t can have multiple roots such as comments only a root with type CYPHER_AST_STATEMENT is considered as the actual root comment roots are ignored

Source from the content-addressed store, hash-verified

68// only a root with type CYPHER_AST_STATEMENT is considered as the actual root
69// comment roots are ignored
70static const cypher_astnode_t *_AST_parse_result_root
71(
72 const cypher_parse_result_t *parse_result
73) {
74 uint nroots = cypher_parse_result_nroots(parse_result);
75 for(uint i = 0; i < nroots; i++) {
76 const cypher_astnode_t *root = cypher_parse_result_get_root(parse_result, i);
77 cypher_astnode_type_t root_type = cypher_astnode_type(root);
78 if(root_type != CYPHER_AST_STATEMENT) {
79 continue;
80 } else {
81 return root;
82 }
83 }
84 ASSERT("_AST_parse_result_root: Parse result should have a valid root" && false);
85 return NULL;
86}
87
88// this method extracts the query's parameters values, convert them into
89// constant SIValues and store them in a map of <name, value>

Callers 3

_AST_Extract_ParamsFunction · 0.85
AST_BuildFunction · 0.85
_AST_ExtractQueryStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected