MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / eval_where

Function eval_where

src/cypher/cypher.c:2500–2523  ·  view source on GitHub ↗

Evaluate WHERE clause — uses expression tree if available, falls back to legacy */

Source from the content-addressed store, hash-verified

2498
2499/* Evaluate WHERE clause — uses expression tree if available, falls back to legacy */
2500static bool eval_where(const cbm_where_clause_t *w, binding_t *b) {
2501 if (!w) {
2502 return true;
2503 }
2504 if (w->root) {
2505 return eval_expr(w->root, b);
2506 }
2507
2508 /* Legacy flat evaluation */
2509 if (w->count == 0) {
2510 return true;
2511 }
2512 bool is_and = (w->op && strcmp(w->op, "AND") == 0) != 0;
2513 for (int i = 0; i < w->count; i++) {
2514 bool r = eval_condition(&w->conditions[i], b);
2515 if (is_and && !r) {
2516 return false;
2517 }
2518 if (!is_and && r) {
2519 return true;
2520 }
2521 }
2522 return is_and;
2523}
2524
2525/* Check if a string value looks like a regex pattern. */
2526static bool looks_like_regex(const char *s) {

Callers 2

filter_bindings_whereFunction · 0.85
execute_singleFunction · 0.85

Calls 2

eval_exprFunction · 0.85
eval_conditionFunction · 0.85

Tested by

no test coverage detected