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

Function cbm_config_get

src/cli/cli.c:2740–2762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2738}
2739
2740const char *cbm_config_get(cbm_config_t *cfg, const char *key, const char *default_val) {
2741 if (!cfg || !key) {
2742 return default_val;
2743 }
2744
2745 sqlite3_stmt *stmt = NULL;
2746 if (sqlite3_prepare_v2(cfg->db, "SELECT value FROM config WHERE key = ?", SQL_NUL_TERM, &stmt,
2747 NULL) != SQLITE_OK) {
2748 return default_val;
2749 }
2750 sqlite3_bind_text(stmt, SQL_PARAM_1, key, SQL_NUL_TERM, cbm_sqlite_transient);
2751
2752 const char *result = default_val;
2753 if (sqlite3_step(stmt) == SQLITE_ROW) {
2754 const char *val = (const char *)sqlite3_column_text(stmt, 0);
2755 if (val) {
2756 snprintf(cfg->get_buf, sizeof(cfg->get_buf), "%s", val);
2757 result = cfg->get_buf;
2758 }
2759 }
2760 sqlite3_finalize(stmt);
2761 return result;
2762}
2763
2764bool cbm_config_get_bool(cbm_config_t *cfg, const char *key, bool default_val) {
2765 const char *val = cbm_config_get(cfg, key, NULL);

Callers 5

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

no test coverage detected