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

Function eval_where

src/cypher/cypher.c:2852–2875  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2850
2851/* Evaluate WHERE clause — uses expression tree if available, falls back to legacy */
2852static bool eval_where(const cbm_where_clause_t *w, binding_t *b) {
2853 if (!w) {
2854 return true;
2855 }
2856 if (w->root) {
2857 return eval_expr(w->root, b);
2858 }
2859
2860 /* Legacy flat evaluation */
2861 if (w->count == 0) {
2862 return true;
2863 }
2864 bool is_and = (w->op && strcmp(w->op, "AND") == 0) != 0;
2865 for (int i = 0; i < w->count; i++) {
2866 bool r = eval_condition(&w->conditions[i], b);
2867 if (is_and && !r) {
2868 return false;
2869 }
2870 if (!is_and && r) {
2871 return true;
2872 }
2873 }
2874 return is_and;
2875}
2876
2877/* Three-valued WHERE evaluation for the early (seed-row) pass in
2878 * execute_single: only the first MATCH alias is bound there, so a leaf on

Callers 1

filter_bindings_whereFunction · 0.85

Calls 2

eval_exprFunction · 0.85
eval_conditionFunction · 0.85

Tested by

no test coverage detected