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

Function cv_count

tests/test_conditional_variants.c:132–147  ·  view source on GitHub ↗

One integer from SQL with text parameters; -1 on any query failure. */

Source from the content-addressed store, hash-verified

130
131/* One integer from SQL with text parameters; -1 on any query failure. */
132static int cv_count(cv_proj_t *p, const char *sql, const char *a, const char *b) {
133 sqlite3 *db = cbm_store_get_db(p->store);
134 sqlite3_stmt *stmt = NULL;
135 if (!db || sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
136 sqlite3_finalize(stmt);
137 return -1;
138 }
139 int n = sqlite3_bind_parameter_count(stmt);
140 const char *values[] = {p->project, a, b};
141 for (int i = 0; i < n && i < 3; i++) {
142 sqlite3_bind_text(stmt, i + 1, values[i], -1, SQLITE_TRANSIENT);
143 }
144 int count = sqlite3_step(stmt) == SQLITE_ROW ? sqlite3_column_int(stmt, 0) : -1;
145 sqlite3_finalize(stmt);
146 return count;
147}
148
149#define CV_DEF_LABELS "('Function','Method','Module','Class')"
150

Callers 3

cv_measureFunction · 0.85
cv_platform_checkFunction · 0.85

Calls 1

cbm_store_get_dbFunction · 0.85

Tested by

no test coverage detected