| 319 | } |
| 320 | |
| 321 | static void _collect_call_projections( |
| 322 | const cypher_astnode_t *call_clause, |
| 323 | rax *identifiers |
| 324 | ) { |
| 325 | uint yield_count = cypher_ast_call_nprojections(call_clause); |
| 326 | |
| 327 | if(yield_count == 0) { |
| 328 | // error if this is a RETURN clause with no aliases |
| 329 | // e.g. |
| 330 | // CALL db.indexes() RETURN * |
| 331 | ErrorCtx_SetError("RETURN * is not allowed when there are no variables in scope"); |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | for(uint i = 0; i < yield_count; i ++) { |
| 336 | const cypher_astnode_t *projection = cypher_ast_call_get_projection(call_clause, i); |
| 337 | const cypher_astnode_t *ast_exp = cypher_ast_projection_get_expression(projection); |
| 338 | |
| 339 | const cypher_astnode_t *alias_node = cypher_ast_projection_get_alias(projection); |
| 340 | if(alias_node == NULL) alias_node = ast_exp; |
| 341 | |
| 342 | const char *identifier = cypher_ast_identifier_get_name(alias_node); |
| 343 | raxTryInsert(identifiers, (unsigned char *)identifier, |
| 344 | strlen(identifier), (void *)alias_node, NULL); |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // collect aliases from a CALL {} clause |
| 349 | static void _collect_call_subquery_projections |
no test coverage detected