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

Function cbm_store_coverage_meta_get

src/store/store.c:3003–3046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3001}
3002
3003int cbm_store_coverage_meta_get(cbm_store_t *s, const char *project, cbm_coverage_meta_t *out) {
3004 if (!out) {
3005 return CBM_STORE_ERR;
3006 }
3007 memset(out, 0, sizeof(*out));
3008 if (!s || !s->db || !project) {
3009 return CBM_STORE_ERR;
3010 }
3011 sqlite3_stmt *stmt = NULL;
3012 if (sqlite3_prepare_v2(s->db,
3013 "SELECT project, generation, index_mode, recorded_at, recording_status, "
3014 "ignored_files_stored, ignored_files_total, coverage_version, "
3015 "hash_records_complete FROM index_coverage_meta WHERE project = ?1;",
3016 CBM_NOT_FOUND, &stmt, NULL) != SQLITE_OK) {
3017 store_set_error_sqlite(s, "coverage meta get prepare");
3018 return CBM_STORE_ERR;
3019 }
3020 bind_text(stmt, SKIP_ONE, project);
3021 int rc = sqlite3_step(stmt);
3022 if (rc == SQLITE_ROW) {
3023 out->project = heap_strdup((const char *)sqlite3_column_text(stmt, 0));
3024 out->generation = heap_strdup((const char *)sqlite3_column_text(stmt, SKIP_ONE));
3025 out->index_mode = heap_strdup((const char *)sqlite3_column_text(stmt, ST_COL_2));
3026 out->recorded_at = heap_strdup((const char *)sqlite3_column_text(stmt, ST_COL_3));
3027 out->recording_status = heap_strdup((const char *)sqlite3_column_text(stmt, CBM_SZ_4));
3028 out->ignored_files_stored = sqlite3_column_int(stmt, CBM_SZ_5);
3029 out->ignored_files_total = sqlite3_column_int(stmt, 6);
3030 out->coverage_version = sqlite3_column_int(stmt, 7);
3031 out->hash_records_complete = sqlite3_column_int(stmt, 8) != 0;
3032 sqlite3_finalize(stmt);
3033 if (!out->project || !out->generation || !out->index_mode || !out->recorded_at ||
3034 !out->recording_status) {
3035 cbm_store_coverage_meta_clear(out);
3036 return CBM_STORE_ERR;
3037 }
3038 return CBM_STORE_OK;
3039 }
3040 sqlite3_finalize(stmt);
3041 if (rc != SQLITE_DONE) {
3042 store_set_error_sqlite(s, "coverage meta get");
3043 return CBM_STORE_ERR;
3044 }
3045 return CBM_STORE_NOT_FOUND;
3046}
3047
3048int cbm_store_coverage_get(cbm_store_t *s, const char *project, cbm_coverage_row_t **out,
3049 int *count) {

Callers 5

test_pipeline.cFile · 0.85
test_store_nodes.cFile · 0.85

Calls 4

store_set_error_sqliteFunction · 0.85
bind_textFunction · 0.85
heap_strdupFunction · 0.70

Tested by

no test coverage detected