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

Function parse_order_by_clause

src/cypher/cypher.c:1764–1783  ·  view source on GitHub ↗

Parse the full comma-separated ORDER BY key list (#1334). Consuming only the * first key left ", key2 ... LIMIT n" unparsed, which silently dropped the * LIMIT and flooded the caller with the whole result set. Returns 0 on * success, CBM_NOT_FOUND when the key list exceeds the modeled maximum. */

Source from the content-addressed store, hash-verified

1762 * LIMIT and flooded the caller with the whole result set. Returns 0 on
1763 * success, CBM_NOT_FOUND when the key list exceeds the modeled maximum. */
1764static int parse_order_by_clause(parser_t *p, cbm_return_clause_t *r) {
1765 expect(p, TOK_BY);
1766 do {
1767 if (r->order_key_count >= CBM_CYPHER_ORDER_KEYS_MAX) {
1768 return CBM_NOT_FOUND;
1769 }
1770 char order_buf[CBM_SZ_256];
1771 parse_order_by_expr(p, order_buf, sizeof(order_buf));
1772 bool desc = false;
1773 if (match(p, TOK_ASC)) {
1774 desc = false;
1775 } else if (match(p, TOK_DESC)) {
1776 desc = true;
1777 }
1778 r->order_keys[r->order_key_count] = heap_strdup(order_buf);
1779 r->order_descs[r->order_key_count] = desc;
1780 r->order_key_count++;
1781 } while (match(p, TOK_COMMA));
1782 return 0;
1783}
1784
1785static void free_return_clause(cbm_return_clause_t *r);
1786

Callers 1

parse_return_or_withFunction · 0.85

Calls 4

expectFunction · 0.85
parse_order_by_exprFunction · 0.85
matchFunction · 0.85
heap_strdupFunction · 0.70

Tested by

no test coverage detected