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

Function eval_where

src/cypher/cypher.c:2724–2747  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2722
2723/* Evaluate WHERE clause — uses expression tree if available, falls back to legacy */
2724static bool eval_where(const cbm_where_clause_t *w, binding_t *b) {
2725 if (!w) {
2726 return true;
2727 }
2728 if (w->root) {
2729 return eval_expr(w->root, b);
2730 }
2731
2732 /* Legacy flat evaluation */
2733 if (w->count == 0) {
2734 return true;
2735 }
2736 bool is_and = (w->op && strcmp(w->op, "AND") == 0) != 0;
2737 for (int i = 0; i < w->count; i++) {
2738 bool r = eval_condition(&w->conditions[i], b);
2739 if (is_and && !r) {
2740 return false;
2741 }
2742 if (!is_and && r) {
2743 return true;
2744 }
2745 }
2746 return is_and;
2747}
2748
2749/* Check if a string value looks like a regex pattern. */
2750static 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