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

Function _Validate_LIMIT_SKIP_Modifiers

src/ast/ast_validations.c:961–987  ·  view source on GitHub ↗

validate limit and skip modifiers

Source from the content-addressed store, hash-verified

959
960// validate limit and skip modifiers
961static AST_Validation _Validate_LIMIT_SKIP_Modifiers
962(
963 const cypher_astnode_t *limit, // limit ast-node
964 const cypher_astnode_t *skip // skip ast-node
965) {
966 if(limit) {
967 // Handle non-integer or non parameter types specified as LIMIT value
968 // The value validation of integer node or parameter node is done in run time evaluation.
969 if(cypher_astnode_type(limit) != CYPHER_AST_INTEGER &&
970 cypher_astnode_type(limit) != CYPHER_AST_PARAMETER) {
971 ErrorCtx_SetError("LIMIT specified value of invalid type, must be a positive integer");
972 return AST_INVALID;
973 }
974 }
975
976 if(skip) {
977 // Handle non-integer or non parameter types specified as skip value
978 // The value validation of integer node or parameter node is done in run time evaluation.
979 if(cypher_astnode_type(skip) != CYPHER_AST_INTEGER &&
980 cypher_astnode_type(skip) != CYPHER_AST_PARAMETER) {
981 ErrorCtx_SetError("SKIP specified value of invalid type, must be a positive integer");
982 return AST_INVALID;
983 }
984 }
985
986 return AST_VALID;
987}
988
989// validate UNION clauses
990static AST_Validation _ValidateUnion_Clauses

Callers 2

_Validate_WITH_ClauseFunction · 0.85
_Validate_RETURN_ClauseFunction · 0.85

Calls 1

ErrorCtx_SetErrorFunction · 0.85

Tested by

no test coverage detected