Go to the source code of this file.
Classes | |
struct | _ConfigDb |
Defines | |
#define | CONFIGDB_BASENAME "config.db" |
#define | CONFIGDB_DIR CONFIG_DIR |
#define | CONFIGDB_FILE (CONFIGDB_DIR DIR_SEP CONFIGDB_BASENAME) |
#define | FINALIZE_SQL_STATEMENT(lvalue) if (lvalue) { sqlite3_finalize(lvalue); lvalue = NULL; } |
#define | do_nothing ((void)0) |
#define | set_sql_error |
#define | handle_sql_error_done { set_sql_error; goto done; } |
#define | handle_sql_error_false { set_sql_error; return FALSE; } |
Functions | |
static gboolean | create_config_db (GError **error) |
static gboolean | ensure_config_db_created (GError **error) |
static gboolean | prepare_sql_statements (ConfigDb *self, GError **error) |
static void | destroy_sql_statements (ConfigDb *self) |
static void | close_config_db_session (ConfigDb *self) |
static gboolean | open_config_db_session (ConfigDb *self, GError **error) |
ConfigDb * | ConfigDb_new (GError **error) |
void | ConfigDb_destroy (ConfigDb *self) |
static gchar * | db_get (ConfigDb *self, const gchar *name, GError **error) |
gchar * | ConfigDb_get_generic (ConfigDb *self, const gchar *name, GError **error) |
static gboolean | db_set (ConfigDb *self, const gchar *name, const gchar *value, GError **error) |
gboolean | ConfigDb_set_generic (ConfigDb *self, const gchar *name, const gchar *value, GError **error) |
Variables | |
static const char | create_tables_sql [] |
#define CONFIGDB_BASENAME "config.db" |
Config database file.
Definition at line 16 of file config_db.c.
#define CONFIGDB_DIR CONFIG_DIR |
Definition at line 17 of file config_db.c.
Referenced by create_config_db().
#define CONFIGDB_FILE (CONFIGDB_DIR DIR_SEP CONFIGDB_BASENAME) |
Definition at line 18 of file config_db.c.
Referenced by create_config_db(), ensure_config_db_created(), open_config_db_session(), and prepare_sql_statements().
#define do_nothing ((void)0) |
Definition at line 154 of file config_db.c.
Referenced by db_get().
#define FINALIZE_SQL_STATEMENT | ( | lvalue | ) | if (lvalue) { sqlite3_finalize(lvalue); lvalue = NULL; } |
Definition at line 70 of file config_db.c.
Referenced by destroy_sql_statements().
#define handle_sql_error_done { set_sql_error; goto done; } |
Definition at line 163 of file config_db.c.
Referenced by db_get().
#define handle_sql_error_false { set_sql_error; return FALSE; } |
Definition at line 165 of file config_db.c.
Referenced by db_set().
#define set_sql_error |
if (error) \ *error = gx_error_new(domain_cl2app, code_database_command, \ "ConfigDb database access error: %s (%d)", \ sqlite3_errmsg(self->db), \ sqlite3_errcode(self->db));
Definition at line 156 of file config_db.c.
static void close_config_db_session | ( | ConfigDb * | self | ) | [static] |
Definition at line 79 of file config_db.c.
References destroy_sql_statements(), logg, and sqlite3_close().
Referenced by ConfigDb_destroy(), and open_config_db_session().
void ConfigDb_destroy | ( | ConfigDb * | self | ) |
Definition at line 145 of file config_db.c.
References close_config_db_session(), and mutex_destroy.
Referenced by ConfigDb_new(), and kr_Controller_destroy().
gchar* ConfigDb_get_generic | ( | ConfigDb * | self, | |
const gchar * | name, | |||
GError ** | error | |||
) |
Definition at line 230 of file config_db.c.
References db_get(), and mutex_synchronized.
ConfigDb* ConfigDb_new | ( | GError ** | error | ) |
Definition at line 119 of file config_db.c.
References ConfigDb_destroy(), ensure_config_db_created(), gx_error_no_memory, mutex_init, and open_config_db_session().
Referenced by kr_Controller_new().
gboolean ConfigDb_set_generic | ( | ConfigDb * | self, | |
const gchar * | name, | |||
const gchar * | value, | |||
GError ** | error | |||
) |
Definition at line 297 of file config_db.c.
References ac_global_Controller, db_set(), kr_Controller_reconfigure(), and mutex_synchronized.
static gboolean create_config_db | ( | GError ** | error | ) | [static] |
Definition at line 23 of file config_db.c.
References CONFIGDB_DIR, CONFIGDB_FILE, create_database(), and create_tables_sql.
Referenced by ensure_config_db_created().
static gchar* db_get | ( | ConfigDb * | self, | |
const gchar * | name, | |||
GError ** | error | |||
) | [static] |
Definition at line 167 of file config_db.c.
References do_nothing, gx_error_no_memory, handle_sql_error_done, new_not_found_error, sqlite3_bind_text(), sqlite3_column_text(), sqlite3_reset(), sqlite3_step(), SQLITE_DONE, SQLITE_ROW, and SQLITE_STATIC.
Referenced by ConfigDb_get_generic(), and db_set().
static gboolean db_set | ( | ConfigDb * | self, | |
const gchar * | name, | |||
const gchar * | value, | |||
GError ** | error | |||
) | [static] |
Definition at line 239 of file config_db.c.
References db_get(), handle_sql_error_false, is_not_found_error, sqlite3_bind_text(), sqlite3_reset(), sqlite3_step(), SQLITE_DONE, SQLITE_STATIC, and validate_lua_syntax().
Referenced by ConfigDb_set_generic().
static void destroy_sql_statements | ( | ConfigDb * | self | ) | [static] |
Definition at line 73 of file config_db.c.
References FINALIZE_SQL_STATEMENT.
Referenced by close_config_db_session(), and log_db_close_session().
static gboolean ensure_config_db_created | ( | GError ** | error | ) | [static] |
Definition at line 31 of file config_db.c.
References assert_error_unset, CONFIGDB_FILE, create_config_db(), and logg.
Referenced by ConfigDb_new().
static gboolean open_config_db_session | ( | ConfigDb * | self, | |
GError ** | error | |||
) | [static] |
Definition at line 98 of file config_db.c.
References close_config_db_session(), code_database_open, CONFIGDB_FILE, domain_cl2app, gx_error_new(), prepare_sql_statements(), sqlite3_open(), and sqlite_get_error_string.
Referenced by ConfigDb_new().
static gboolean prepare_sql_statements | ( | ConfigDb * | self, | |
GError ** | error | |||
) | [static] |
Definition at line 55 of file config_db.c.
References code_database_state_init, CONFIGDB_FILE, domain_cl2app, gx_error_new(), sqlite3_errcode(), sqlite3_errmsg(), and sqlite_prepare.
Referenced by log_db_open_session(), and open_config_db_session().
const char create_tables_sql[] [static] |
"create table configuration (name TEXT UNIQUE, value TEXT);"
Definition at line 20 of file config_db.c.
Referenced by create_config_db().
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:58 2011 by Doxygen 1.6.1