diff options
Diffstat (limited to 'src/dblayer.c')
-rw-r--r-- | src/dblayer.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/dblayer.c b/src/dblayer.c index 8014d08..4a356be 100644 --- a/src/dblayer.c +++ b/src/dblayer.c @@ -16,13 +16,13 @@ #include "dbhelper.h" #include "ckutil.h" -const char * const DB_NAME = "/ckdb"; +const char * const DB_FILE_NAME = "/ckdb"; /* figure out the database name */ void make_db_name(char *ret, const char *confPath) { char db_path[STR_L]; strcpy(db_path, confPath); - strcat(db_path, DB_NAME); + strcat(db_path, DB_FILE_NAME); strcpy(ret, db_path); } @@ -117,7 +117,7 @@ void init_make_tables(DB *db) { int rc = sqlite3_exec(db->ptr, sql, 0, 0, 0); if (rc != SQLITE_OK ) { - PRINT_ERR("Could not create empry db."); + PRINT_ERR("Could not create empty db."); db->error = SQL_ERR_SQLITE; return; } @@ -411,3 +411,23 @@ int edit_get_prime_config_from_program(DB *db, char *pName, char *ret, int *secr /* No prime config found */ return 0; } + +int list_get_paths(DB *db, cklist *ckl) { + sqlite3_stmt *stmt; + int rc; + + char sql[STR_M]; + dbh_form_query_select_paths(sql); + + rc = sqlite3_prepare_v2(db->ptr, sql, -1, &stmt, 0); + if (rc != SQLITE_OK) { + return -2; + } + + while (sqlite3_step(stmt) == SQLITE_ROW) { + list_add(ckl, (char *)sqlite3_column_text(stmt, 0)); + } + sqlite3_finalize(stmt); + + return 1; +} |