aboutsummaryrefslogtreecommitdiffstats
path: root/src/dblayer.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-04-15 06:15:06 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-04-15 06:15:06 +0300
commit6f319efab77e88e06acb689923ad619bf4c78304 (patch)
tree8d13fc584108627efb5d6b769e64a690b7d9552a /src/dblayer.c
parentc42092733d664c29d3ac9084859f57ec463f72e3 (diff)
downloadck-6f319efab77e88e06acb689923ad619bf4c78304.tar.gz
ck-6f319efab77e88e06acb689923ad619bf4c78304.tar.bz2
ck-6f319efab77e88e06acb689923ad619bf4c78304.zip
variable conf
Diffstat (limited to 'src/dblayer.c')
-rw-r--r--src/dblayer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dblayer.c b/src/dblayer.c
index eee60a6..180cd93 100644
--- a/src/dblayer.c
+++ b/src/dblayer.c
@@ -51,11 +51,15 @@ int check_initialized_DB(sqlite3 *db) {
}
DB empty_DB(SqlError err) {
- return (DB){ .get = NULL, .error = err };
+ return (DB){ .ptr = NULL, .error = err };
}
DB new_DB(sqlite3 *db) {
- return (DB){ .get = db, .error = SQL_NO_ERR };
+ return (DB){ .ptr = db, .error = SQL_NO_ERR };
+}
+
+void close_DB(DB *db) {
+ sqlite3_close(db->ptr);
}
DB init_make_DB() {
@@ -102,7 +106,7 @@ void init_make_tables(DB *db) {
"prime INT NOT NULL);";
char *err_msg = NULL;
- int rc = sqlite3_exec(db->get, sql, 0, 0, &err_msg);
+ int rc = sqlite3_exec(db->ptr, sql, 0, 0, &err_msg);
if (rc != SQLITE_OK ) {
printf("SQL error: %s\n", err_msg);
sqlite3_free(err_msg);