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

Function cbm_config_get

src/cli/cli.c:7445–7468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7443}
7444
7445const char *cbm_config_get(cbm_config_t *cfg, const char *key, const char *default_val) {
7446 static CBM_TLS char result_buf[CLI_BUF_4K];
7447 if (!cfg || !key) {
7448 return default_val;
7449 }
7450
7451 sqlite3_stmt *stmt = NULL;
7452 if (sqlite3_prepare_v2(cfg->db, "SELECT value FROM config WHERE key = ?", SQL_NUL_TERM, &stmt,
7453 NULL) != SQLITE_OK) {
7454 return default_val;
7455 }
7456 sqlite3_bind_text(stmt, SQL_PARAM_1, key, SQL_NUL_TERM, cbm_sqlite_transient);
7457
7458 const char *result = default_val;
7459 if (sqlite3_step(stmt) == SQLITE_ROW) {
7460 const char *val = (const char *)sqlite3_column_text(stmt, 0);
7461 if (val) {
7462 snprintf(result_buf, sizeof(result_buf), "%s", val);
7463 result = result_buf;
7464 }
7465 }
7466 sqlite3_finalize(stmt);
7467 return result;
7468}
7469
7470bool cbm_config_get_bool_set(cbm_config_t *cfg, const char *key, bool *value) {
7471 const char *val = cbm_config_get(cfg, key, NULL);

Callers 8

cbm_config_get_bool_setFunction · 0.85
cbm_config_get_intFunction · 0.85
cbm_cmd_configFunction · 0.85
handle_ui_configFunction · 0.85
test_cli.cFile · 0.85

Calls

no outgoing calls

Tested by 1