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

Function settings_open_snapshot

src/cli/runtime_settings.c:505–520  ·  view source on GitHub ↗

Read-only connection holding one read snapshot (BEGIN + a schema read), or * NULL. A writer mid-commit is waited out; a database still locked after the * bound is an error, not an absent override. */

Source from the content-addressed store, hash-verified

503 * NULL. A writer mid-commit is waited out; a database still locked after the
504 * bound is an error, not an absent override. */
505static sqlite3 *settings_open_snapshot(const char *path, bool *hot_journal) {
506 *hot_journal = false;
507 sqlite3 *db = NULL;
508 if (sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
509 if (db)
510 sqlite3_close(db);
511 return NULL;
512 }
513 cbm_runtime_settings_wait_for_writers(db);
514 if (sqlite3_exec(db, "BEGIN; SELECT count(*) FROM sqlite_master", NULL, NULL, NULL) ==
515 SQLITE_OK)
516 return db;
517 *hot_journal = sqlite3_extended_errcode(db) == SQLITE_READONLY_ROLLBACK;
518 sqlite3_close(db);
519 return NULL;
520}
521
522static sqlite3 *settings_read_snapshot(const char *path) {
523 bool hot_journal = false;

Callers 1

settings_read_snapshotFunction · 0.85

Tested by

no test coverage detected