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

Function binding_get_virtual

src/cypher/cypher.c:2870–2902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2868/* ── Binding virtual variables (for WITH clause) ──────────────── */
2869
2870static const char *binding_get_virtual(binding_t *b, const char *var, const char *prop) {
2871 if (!var) {
2872 return "";
2873 }
2874 /* Check virtual vars first (from WITH projection) */
2875 char full[CBM_SZ_256];
2876 if (prop) {
2877 snprintf(full, sizeof(full), "%s.%s", var, prop);
2878 } else {
2879 snprintf(full, sizeof(full), "%s", var);
2880 }
2881 for (int i = 0; i < b->var_count; i++) {
2882 if (strcmp(b->var_names[i], full) == 0) {
2883 return b->var_nodes[i].name ? b->var_nodes[i].name : "";
2884 }
2885 }
2886 /* Fall through to normal lookup */
2887 cbm_edge_t *e = binding_get_edge(b, var);
2888 if (e) {
2889 /* Bare `RETURN r` on an edge: surface the full properties JSON
2890 * (or "{}" if none) so callers can inspect timestamps, weights,
2891 * etc. without naming each property. */
2892 return prop ? edge_prop(e, prop) : (e->properties_json ? e->properties_json : "{}");
2893 }
2894 cbm_node_t *n = binding_get(b, var);
2895 if (n) {
2896 if (prop) {
2897 return node_prop(n, prop, b->store);
2898 }
2899 return n->name ? n->name : "";
2900 }
2901 return "";
2902}
2903
2904/* ── String function application ──────────────────────────────── */
2905

Callers 6

eval_func_argFunction · 0.85
project_itemFunction · 0.85
sort_bindingsFunction · 0.85
with_agg_accumulateFunction · 0.85
with_proj_keyFunction · 0.85
ret_agg_accumulateFunction · 0.85

Calls 4

binding_get_edgeFunction · 0.85
edge_propFunction · 0.85
binding_getFunction · 0.85
node_propFunction · 0.85

Tested by

no test coverage detected