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

Function where_add_regex

src/store/store.c:2459–2470  ·  view source on GitHub ↗

Append a regex WHERE clause for a column (case-sensitive or insensitive). */

Source from the content-addressed store, hash-verified

2457
2458/* Append a regex WHERE clause for a column (case-sensitive or insensitive). */
2459static void where_add_regex(char *where, int where_sz, int *wlen, int *nparams,
2460 search_bind_t *binds, int *bind_idx, const char *column,
2461 const char *pattern, bool case_sensitive) {
2462 char buf[CBM_SZ_128];
2463 if (case_sensitive) {
2464 snprintf(buf, sizeof(buf), "%s REGEXP ?%d", column, *bind_idx + SKIP_ONE);
2465 } else {
2466 snprintf(buf, sizeof(buf), "iregexp(?%d, %s)", *bind_idx + SKIP_ONE, column);
2467 }
2468 *wlen = where_append(where, where_sz, *wlen, nparams, buf);
2469 where_bind_text(binds, bind_idx, pattern);
2470}
2471
2472/* Prepend LIKE pre-filter conditions for literal segments of a regex pattern.
2473 * The idx_nodes_name index satisfies LIKE '%literal%', cutting the rows that

Callers 1

search_where_basicFunction · 0.85

Calls 2

where_appendFunction · 0.85
where_bind_textFunction · 0.85

Tested by

no test coverage detected