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

Function eval_where

src/cypher/cypher.c:2723–2746  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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