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

Function cv_text

tests/test_conditional_variants.c:425–446  ·  view source on GitHub ↗

One text value from SQL with text parameters (as cv_count); false when the * query fails or returns no row or NULL. */

Source from the content-addressed store, hash-verified

423/* One text value from SQL with text parameters (as cv_count); false when the
424 * query fails or returns no row or NULL. */
425static bool cv_text(cv_proj_t *p, const char *sql, const char *a, const char *b, char *out,
426 size_t n) {
427 sqlite3 *db = cbm_store_get_db(p->store);
428 sqlite3_stmt *stmt = NULL;
429 out[0] = '\0';
430 if (!db || sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
431 sqlite3_finalize(stmt);
432 return false;
433 }
434 int params = sqlite3_bind_parameter_count(stmt);
435 const char *values[] = {p->project, a, b};
436 for (int i = 0; i < params && i < 3; i++) {
437 sqlite3_bind_text(stmt, i + 1, values[i], -1, SQLITE_TRANSIENT);
438 }
439 const char *text =
440 sqlite3_step(stmt) == SQLITE_ROW ? (const char *)sqlite3_column_text(stmt, 0) : NULL;
441 if (text) {
442 snprintf(out, n, "%s", text);
443 }
444 sqlite3_finalize(stmt);
445 return text != NULL;
446}
447
448/* One platform variant of `pick`: its file, the function its body calls, and
449 * the other variant's callee, which must not be reached from it. */

Callers 1

cv_platform_checkFunction · 0.85

Calls 1

cbm_store_get_dbFunction · 0.85

Tested by

no test coverage detected