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

Function prepare_cached

src/store/store.c:199–214  ·  view source on GitHub ↗

Prepare a statement (cached). If already prepared, reset+clear. */

Source from the content-addressed store, hash-verified

197
198/* Prepare a statement (cached). If already prepared, reset+clear. */
199static sqlite3_stmt *prepare_cached(cbm_store_t *s, sqlite3_stmt **slot, const char *sql) {
200 if (!s || !s->db) {
201 return NULL;
202 }
203 if (*slot) {
204 sqlite3_reset(*slot);
205 sqlite3_clear_bindings(*slot);
206 return *slot;
207 }
208 int rc = sqlite3_prepare_v2(s->db, sql, CBM_NOT_FOUND, slot, NULL);
209 if (rc != SQLITE_OK) {
210 store_set_error_sqlite(s, "prepare");
211 return NULL;
212 }
213 return *slot;
214}
215
216/* Get ISO-8601 timestamp. */
217static void iso_now(char *buf, size_t sz) {

Callers 15

cbm_store_upsert_projectFunction · 0.85
cbm_store_get_projectFunction · 0.85
cbm_store_list_projectsFunction · 0.85
cbm_store_delete_projectFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85
find_nodes_genericFunction · 0.85
cbm_store_count_nodesFunction · 0.85

Calls 1

store_set_error_sqliteFunction · 0.85

Tested by

no test coverage detected