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

Function execute_single

src/cypher/cypher.c:6241–6271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6239}
6240
6241static int execute_single(cbm_store_t *store, cbm_query_t *q, const char *project, int max_rows,
6242 result_builder_t *rb) {
6243 cypher_plan_seed_from_selective_end(q);
6244 cbm_pattern_t *pat0 = &q->patterns[0];
6245
6246 /* Step 1: Scan initial nodes, streamed */
6247 start_source_t src;
6248 start_source_open(&src, store, project, &pat0->nodes[0]);
6249
6250 cypher_sink_t sink;
6251 with_sink_init(&sink.with, q->with_clause);
6252 ret_sink_init(&sink.ret, q, max_rows, rb);
6253
6254 /* Steps 2-4 per chunk: expand, late WHERE, WITH / RETURN. The pipeline
6255 * runs at least once, so an empty scan still reaches the additional
6256 * patterns and the projection exactly as a single pass does. */
6257 int chunk = q->pattern_count > SKIP_ONE ? INT_MAX : cypher_stream_chunk();
6258 int rc = 0;
6259 int start_index = 0;
6260 do {
6261 rc = execute_chunk(store, q, project, max_rows, &src, chunk, &start_index, &sink);
6262 } while (rc == 0 && !src.done && !g_cypher_timed_out);
6263 start_source_close(&src);
6264
6265 if (rc == 0) {
6266 sink_finish(&sink, q);
6267 } else {
6268 sink_free(&sink);
6269 }
6270 return rc;
6271}
6272
6273/* ── Main entry point ─────────────────────────────────────────── */
6274

Callers 1

cbm_cypher_executeFunction · 0.85

Calls 9

start_source_openFunction · 0.85
with_sink_initFunction · 0.85
ret_sink_initFunction · 0.85
cypher_stream_chunkFunction · 0.85
execute_chunkFunction · 0.85
start_source_closeFunction · 0.85
sink_finishFunction · 0.85
sink_freeFunction · 0.85

Tested by

no test coverage detected