From 6f319efab77e88e06acb689923ad619bf4c78304 Mon Sep 17 00:00:00 2001 From: gramanas Date: Sun, 15 Apr 2018 06:15:06 +0300 Subject: variable conf --- src/dblayer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/dblayer.c') 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); -- cgit v1.2.3