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

Function cbm_config_get

src/cli/cli.c:7312–7335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7310}
7311
7312const char *cbm_config_get(cbm_config_t *cfg, const char *key, const char *default_val) {
7313 static CBM_TLS char result_buf[CLI_BUF_4K];
7314 if (!cfg || !key) {
7315 return default_val;
7316 }
7317
7318 sqlite3_stmt *stmt = NULL;
7319 if (sqlite3_prepare_v2(cfg->db, "SELECT value FROM config WHERE key = ?", SQL_NUL_TERM, &stmt,
7320 NULL) != SQLITE_OK) {
7321 return default_val;
7322 }
7323 sqlite3_bind_text(stmt, SQL_PARAM_1, key, SQL_NUL_TERM, cbm_sqlite_transient);
7324
7325 const char *result = default_val;
7326 if (sqlite3_step(stmt) == SQLITE_ROW) {
7327 const char *val = (const char *)sqlite3_column_text(stmt, 0);
7328 if (val) {
7329 snprintf(result_buf, sizeof(result_buf), "%s", val);
7330 result = result_buf;
7331 }
7332 }
7333 sqlite3_finalize(stmt);
7334 return result;
7335}
7336
7337bool cbm_config_get_bool(cbm_config_t *cfg, const char *key, bool default_val) {
7338 const char *val = cbm_config_get(cfg, key, NULL);

Callers 6

cbm_config_get_boolFunction · 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