aboutsummaryrefslogtreecommitdiffstats
path: root/src/dblayer.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-08-18 18:44:14 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-08-18 18:44:14 +0300
commit0f33c8a9cbabda257c4dd73009266a4cf5f857a7 (patch)
tree1b0ca0c9a3d06b6ccd32c456f8fe8d84cb153093 /src/dblayer.c
parentffc33043a488ecf038d8414fc8af1e99389619f8 (diff)
downloadck-0f33c8a9cbabda257c4dd73009266a4cf5f857a7.tar.gz
ck-0f33c8a9cbabda257c4dd73009266a4cf5f857a7.tar.bz2
ck-0f33c8a9cbabda257c4dd73009266a4cf5f857a7.zip
steps towards list
Diffstat (limited to 'src/dblayer.c')
-rw-r--r--src/dblayer.c26
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;
+}