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

Function AST_BuildReturnColumnNames

src/ast/ast.c:584–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584const char **AST_BuildReturnColumnNames
585(
586 const cypher_astnode_t *return_clause
587) {
588 // all RETURN * clauses should have been converted to explicit lists
589 ASSERT(cypher_ast_return_has_include_existing(return_clause) == false);
590
591 // Collect every alias from the RETURN projections.
592 uint projection_count = cypher_ast_return_nprojections(return_clause);
593 const char **columns = array_new(const char *, projection_count);
594 for(uint i = 0; i < projection_count; i++) {
595 const cypher_astnode_t *projection = cypher_ast_return_get_projection(return_clause, i);
596 const cypher_astnode_t *ast_alias = cypher_ast_projection_get_alias(projection);
597 // If the projection was not aliased, the projection itself is an identifier.
598 if(ast_alias == NULL) ast_alias = cypher_ast_projection_get_expression(projection);
599 const char *alias = cypher_ast_identifier_get_name(ast_alias);
600 array_append(columns, alias);
601 }
602
603 return columns;
604}
605
606const char **AST_BuildCallColumnNames
607(

Callers 2

_ResultSet_SetColumnsFunction · 0.85
_Validate_RETURN_ClauseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected