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

Function parse_params

src/ast/ast.c:781–814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781cypher_parse_result_t *parse_params
782(
783 const char *query,
784 const char **query_body
785) {
786 ASSERT(query != NULL);
787 ASSERT(query_body != NULL);
788
789 FILE *f = fmemopen((char *)query, strlen(query), "r");
790 cypher_parse_result_t *result = cypher_fparse(f, NULL, NULL,
791 CYPHER_PARSE_ONLY_PARAMETERS);
792 fclose(f);
793
794 if(!result) {
795 return NULL;
796 }
797
798 if(AST_Validate_QueryParams(result) != AST_VALID) {
799 parse_result_free(result);
800 return NULL;
801 }
802
803 _AST_Extract_Params(result);
804
805 // see if we've encountered an error while evaluating parameter value
806 if(ErrorCtx_EncounteredError()) {
807 parse_result_free(result);
808 return NULL;
809 }
810
811 *query_body = _AST_ExtractQueryString(result);
812
813 return result;
814}
815
816void parse_result_free
817(

Callers 1

ExecutionCtx_FromQueryFunction · 0.85

Calls 5

AST_Validate_QueryParamsFunction · 0.85
parse_result_freeFunction · 0.85
_AST_Extract_ParamsFunction · 0.85
_AST_ExtractQueryStringFunction · 0.85

Tested by

no test coverage detected