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

Function _collect_with_projections

src/ast/ast_shared.c:294–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294static void _collect_with_projections
295(
296 const cypher_astnode_t *with_clause,
297 rax *identifiers
298) {
299 uint projection_count = cypher_ast_with_nprojections(with_clause);
300 for(uint i = 0; i < projection_count; i ++) {
301 const cypher_astnode_t *projection =
302 cypher_ast_with_get_projection(with_clause, i);
303 const cypher_astnode_t *identifier_node =
304 cypher_ast_projection_get_alias(projection);
305 if(identifier_node == NULL) {
306 // the projection was not aliased
307 // so the projection itself must be an identifier
308 identifier_node = cypher_ast_projection_get_expression(projection);
309 ASSERT(cypher_astnode_type(identifier_node) == CYPHER_AST_IDENTIFIER);
310 } else {
311 // do not include empty projections, which may have been made to
312 // handle the MATCH () WITH * case
313 if(!strcmp(cypher_ast_identifier_get_name(identifier_node), "")) continue;
314 }
315 const char *identifier = cypher_ast_identifier_get_name(identifier_node);
316 raxTryInsert(identifiers, (unsigned char *)identifier,
317 strlen(identifier), (void *)identifier_node, NULL);
318 }
319}
320
321static void _collect_call_projections(
322 const cypher_astnode_t *call_clause,

Callers 1

collect_aliases_in_scopeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected