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

Function search_sql_append

src/store/store.c:7272–7285  ·  view source on GitHub ↗

Main and count SQL over the name ranges: one UNION ALL arm per range, each * the plain WHERE plus its range, so every arm seeks idx_nodes_name. The arms * are disjoint and each yields (name, id) order, so ORDER BY 4, 1 (n.name, * n.id) merges them without a sort and the per-row degree subqueries run only * for rows the page emits; the count sums the per-range counts. On false * (allocation, b

Source from the content-addressed store, hash-verified

7270/* Append to buf[0..cap) at *len; false (nothing written past cap) when it
7271 * does not fit. */
7272static bool search_sql_append(char *buf, size_t cap, size_t *len, const char *fmt, ...) {
7273 if (*len >= cap) {
7274 return false;
7275 }
7276 va_list args;
7277 va_start(args, fmt);
7278 int wrote = vsnprintf(buf + *len, cap - *len, fmt, args);
7279 va_end(args);
7280 if (wrote < 0 || (size_t)wrote >= cap - *len) {
7281 return false;
7282 }
7283 *len += (size_t)wrote;
7284 return true;
7285}
7286
7287static bool search_build_ranged_sql(const char *select_cols, const char *where,
7288 const search_name_ranges_t *r, int limit, int offset,

Callers 1

search_build_ranged_sqlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected