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

Function _add_names_projections

src/ast/ast_rewrite_call_subquery.c:43–69  ·  view source on GitHub ↗

adds projections from `names` to `inter_names` into `projections` array

Source from the content-addressed store, hash-verified

41
42// adds projections from `names` to `inter_names` into `projections` array
43static uint _add_names_projections
44(
45 cypher_astnode_t *projections[], // array of projections
46 uint proj_idx, // index to start adding projections
47 char **names, // bound vars
48 char **inter_names, // internal representation of bound vars
49 bool hide // hide or reveal vars
50) {
51 uint n_names = hide ? array_len(names) : array_len(inter_names);
52
53 for(uint i = 0; i < n_names; i++) {
54 // create a projection for the bound var
55 struct cypher_input_range range = {0};
56 cypher_astnode_t *exp = cypher_ast_identifier(names[i],
57 strlen(names[i]), range);
58 cypher_astnode_t *alias = cypher_ast_identifier(inter_names[i],
59 strlen(inter_names[i]), range);
60 cypher_astnode_t *children[2];
61 children[0] = exp;
62 children[1] = alias;
63
64 projections[proj_idx++] = cypher_ast_projection(exp, alias, children,
65 2, range);
66 }
67
68 return proj_idx;
69}
70
71// add projections to projections array, corresponding to the bound vars (names)
72// and their internal representation (inter_names)

Callers 1

_add_projectionsFunction · 0.85

Calls 1

array_lenFunction · 0.85

Tested by

no test coverage detected