mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-28 07:03:20 +08:00
Add additive metadata tables and indexes for future staged exact-delta indexing: generations, file state, node/edge owners, symbol exports, import refs, and derived view freshness. Keep this slice behavior-neutral. Normal store open migrates the schema, query-only open still does not create missing DBs, and writer-produced DBs remain minimal but migrate through cbm_store_open_path(). Validation: make -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=store_nodes ./build/c/test-runner; CBM_ONLY_SUITE=sqlite_writer ./build/c/test-runner; CBM_ONLY_SUITE=tool_consolidation ./build/c/test-runner; CBM_ONLY_SUITE=store_search ./build/c/test-runner; CBM_ONLY_SUITE=store_bulk ./build/c/test-runner; CBM_ONLY_SUITE=incremental ./build/c/test-runner; bash scripts/check-source-safety.sh; git diff --check. Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
23 lines
695 B
C
23 lines
695 B
C
#ifndef TEST_SQLITE_HELPERS_H
|
|
#define TEST_SQLITE_HELPERS_H
|
|
|
|
#include "sqlite3.h"
|
|
|
|
static inline int cbm_test_sqlite_object_exists(sqlite3 *db, const char *type, const char *name) {
|
|
sqlite3_stmt *stmt = NULL;
|
|
int exists = 0;
|
|
if (!db || !type || !name ||
|
|
sqlite3_prepare_v2(db,
|
|
"SELECT 1 FROM sqlite_master WHERE type = ?1 AND name = ?2 LIMIT 1",
|
|
-1, &stmt, NULL) != SQLITE_OK) {
|
|
return 0;
|
|
}
|
|
sqlite3_bind_text(stmt, 1, type, -1, SQLITE_STATIC);
|
|
sqlite3_bind_text(stmt, 2, name, -1, SQLITE_STATIC);
|
|
exists = sqlite3_step(stmt) == SQLITE_ROW;
|
|
sqlite3_finalize(stmt);
|
|
return exists;
|
|
}
|
|
|
|
#endif
|