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

Function order_key_value

src/cypher/cypher.c:4405–4423  ·  view source on GitHub ↗

Resolve one WITH ORDER BY key on a projected binding. The key is either a * projected name (`c`, or an unaliased `f.name`) or a property of a carried * node (`g.start_line` after `WITH f AS g`, #2208): an exact projected name * wins, otherwise `var.prop` is split and resolved on the carried node. */

Source from the content-addressed store, hash-verified

4403 * node (`g.start_line` after `WITH f AS g`, #2208): an exact projected name
4404 * wins, otherwise `var.prop` is split and resolved on the carried node. */
4405static const char *order_key_value(binding_t *b, const char *key) {
4406 const char *dot = strchr(key, '.');
4407 if (!dot) {
4408 return binding_get_virtual(b, key, NULL);
4409 }
4410 for (int i = 0; i < b->var_count; i++) {
4411 if (strcmp(b->var_names[i], key) == 0) {
4412 return binding_get_virtual(b, key, NULL);
4413 }
4414 }
4415 char var[CBM_SZ_256];
4416 size_t vlen = (size_t)(dot - key);
4417 if (vlen >= sizeof(var)) {
4418 return "";
4419 }
4420 memcpy(var, key, vlen);
4421 var[vlen] = '\0';
4422 return binding_get_virtual(b, var, dot + SKIP_ONE);
4423}
4424
4425/* One WITH ORDER BY key comparison: numerically when both values start with a
4426 * number, else by strcmp; positive = a after b. */

Callers 2

sort_bindingsFunction · 0.85

Calls 1

binding_get_virtualFunction · 0.85

Tested by

no test coverage detected