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

Function gd_seed

tests/test_store_graph_digest.c:57–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 return ok;
56}
57static bool gd_seed(sqlite3 *db, bool reverse, bool meta) {
58 static const char drop[] = "PRAGMA foreign_keys=OFF;"
59 "DROP TABLE IF EXISTS edges;DROP TABLE IF EXISTS nodes;DROP TABLE IF EXISTS file_hashes;"
60 "DROP TABLE IF EXISTS project_summaries;DROP TABLE IF EXISTS lsp_surface;"
61 "DROP TABLE IF EXISTS index_coverage;DROP TABLE IF EXISTS index_coverage_meta;"
62 "DROP TABLE IF EXISTS projects;DROP TABLE IF EXISTS store_meta;";
63 if (!db || gd_sql(db,drop)!=SQLITE_OK) return false;
64 for (size_t i=0;i<8+(size_t)meta;i++) if (gd_sql(db,gd_schema[i])!=SQLITE_OK) return false;
65 size_t n=sizeof(gd_inserts)/sizeof(gd_inserts[0]);
66 for (size_t i=0;i<n;i++) if (gd_sql(db,gd_inserts[reverse?n-i-1:i])!=SQLITE_OK) return false;
67 return !meta || gd_sql(db,"INSERT INTO store_meta VALUES('db_uid','0123456789abcdef'),"
68 "('mutation_gen','7'),('future','opaque')")==SQLITE_OK;
69}
70static cbm_store_t *gd_fixture(bool reverse, bool meta) {
71 cbm_store_t *s=cbm_store_open_memory();
72 if (s && !gd_seed(cbm_store_get_db(s),reverse,meta)) { cbm_store_close(s);s=NULL; }

Callers 2

gd_fixtureFunction · 0.85

Calls 1

gd_sqlFunction · 0.85

Tested by

no test coverage detected