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

Function vs_probe_node_vectors_table

src/store/store.c:12286–12304  ·  view source on GitHub ↗

A lean index carries no node_vectors table at all. That is an empty * semantic universe, not a scan failure, and callers must be able to tell * the two apart — so probe the schema before preparing the scan. Returns * CBM_STORE_OK (present), CBM_STORE_NOT_FOUND (absent) or CBM_STORE_ERR. */

Source from the content-addressed store, hash-verified

12284 * the two apart — so probe the schema before preparing the scan. Returns
12285 * CBM_STORE_OK (present), CBM_STORE_NOT_FOUND (absent) or CBM_STORE_ERR. */
12286static int vs_probe_node_vectors_table(cbm_store_t *s) {
12287 sqlite3_stmt *probe = NULL;
12288 const char *sql =
12289 "SELECT 1 FROM sqlite_master WHERE type='table' AND name='node_vectors' LIMIT 1;";
12290 if (sqlite3_prepare_v2(s->db, sql, SQLITE_AUTO_LEN, &probe, NULL) != SQLITE_OK) {
12291 (void)fprintf(stderr, "vector_search: %s\n", sqlite3_errmsg(s->db));
12292 return CBM_STORE_ERR;
12293 }
12294 int step_rc = sqlite3_step(probe);
12295 sqlite3_finalize(probe);
12296 if (step_rc == SQLITE_ROW) {
12297 return CBM_STORE_OK;
12298 }
12299 if (step_rc == SQLITE_DONE) {
12300 return CBM_STORE_NOT_FOUND;
12301 }
12302 (void)fprintf(stderr, "vector_search: %s\n", sqlite3_errmsg(s->db));
12303 return CBM_STORE_ERR;
12304}
12305
12306static int vs_ranked_result_cmp(const void *lhs, const void *rhs) {
12307 const cbm_vector_result_t *a = lhs;

Callers 1

cbm_store_vector_searchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected