| 582 | } |
| 583 | |
| 584 | const 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 | |
| 606 | const char **AST_BuildCallColumnNames |
| 607 | ( |
no outgoing calls
no test coverage detected