make sure multi-hop traversals has length greater than or equal to zero
| 184 | |
| 185 | // make sure multi-hop traversals has length greater than or equal to zero |
| 186 | static AST_Validation _ValidateMultiHopTraversal |
| 187 | ( |
| 188 | const cypher_astnode_t *edge, // ast-node to validate |
| 189 | const cypher_astnode_t *range // varlength range |
| 190 | ) { |
| 191 | int start = 1; |
| 192 | int end = INT_MAX - 2; |
| 193 | |
| 194 | const cypher_astnode_t *range_start = cypher_ast_range_get_start(range); |
| 195 | if(range_start) { |
| 196 | start = AST_ParseIntegerNode(range_start); |
| 197 | } |
| 198 | |
| 199 | const cypher_astnode_t *range_end = cypher_ast_range_get_end(range); |
| 200 | if(range_end) { |
| 201 | end = AST_ParseIntegerNode(range_end); |
| 202 | } |
| 203 | |
| 204 | // Validate specified range |
| 205 | if(start > end) { |
| 206 | ErrorCtx_SetError("Variable length path, maximum number of hops must be greater or equal to minimum number of hops."); |
| 207 | return AST_INVALID; |
| 208 | } |
| 209 | |
| 210 | return AST_VALID; |
| 211 | } |
| 212 | |
| 213 | // Verify that MERGE doesn't redeclare bound relations, that one reltype is specified for unbound relations, |
| 214 | // and that the entity is not a variable length pattern |
no test coverage detected