aboutsummaryrefslogtreecommitdiff
path: root/db.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-07-06 15:31:44 +0200
committertomsmeding <tom.smeding@gmail.com>2017-07-06 15:31:44 +0200
commitd77281680b96dad90a774998cc759dd676954806 (patch)
tree100c686c843bc75f327974585e909805709f9e3a /db.c
parenta2cc9e73ca3e5d20418ccc2922576b9f5cee357e (diff)
server: Fix multithreading with firebase
Diffstat (limited to 'db.c')
-rw-r--r--db.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/db.c b/db.c
index f48148e..32a8df4 100644
--- a/db.c
+++ b/db.c
@@ -22,6 +22,7 @@ void db_init(void){
SQLITE(config,SQLITE_CONFIG_SERIALIZED);
SQLITE(initialize);
SQLITE(open_v2,"db.db",&database,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE,NULL);
+ SQLITE(busy_timeout,database,500);
char *str=malloc(schema_sql_len+1,char);
memcpy(str,schema_sql,schema_sql_len);
str[schema_sql_len]='\0';
@@ -29,6 +30,11 @@ void db_init(void){
free(str);
}
+void db_reinit(void){
+ SQLITE(open_v2,"db.db",&database,SQLITE_OPEN_READWRITE,NULL);
+ SQLITE(busy_timeout,database,500);
+}
+
void db_close(void){
sqlite3_close(database);
SQLITE(shutdown);