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

Function union_query

tests/test_cypher.c:5484–5501  ·  view source on GitHub ↗

Branch i selects fixture node i % 5 by name; `join` is " UNION " or * " UNION ALL ". */

Source from the content-addressed store, hash-verified

5482/* Branch i selects fixture node i % 5 by name; `join` is " UNION " or
5483 * " UNION ALL ". */
5484static char *union_query(int branches, const char *join) {
5485 size_t cap = 64 + (size_t)branches * 80;
5486 char *q = malloc(cap);
5487 if (!q) {
5488 return NULL;
5489 }
5490 size_t len = 0;
5491 for (int i = 0; i < branches && len < cap; i++) {
5492 len +=
5493 (size_t)snprintf(q + len, cap - len, "%sMATCH (n) WHERE n.name = \"%s\" RETURN n.name",
5494 i ? join : "", cypher_fixture_nodes[i % CYPHER_FIXTURE_NODE_COUNT]);
5495 }
5496 if (len >= cap) {
5497 free(q);
5498 return NULL;
5499 }
5500 return q;
5501}
5502
5503enum { CYPHER_UNION_MANY_BRANCHES = 20000 };
5504

Callers 2

union_many_checkFunction · 0.85
test_cypher.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected