db: Use Write-Ahead Logging mode of SQLite3
diff --git a/src/db.c b/src/db.c
index 4424307..82c901b 100644
--- a/src/db.c
+++ b/src/db.c
@@ -105,6 +105,12 @@
if (rc != SQLITE_OK)
LOGP(DDB, LOGL_ERROR, "Unable to enable SQlite3 extended result codes\n");
+ char *err_msg;
+ rc = sqlite3_exec(dbc->db, "PRAGMA journal_mode=WAL; PRAGMA synchonous = NORMAL;", 0, 0, &err_msg);
+ if (rc != SQLITE_OK)
+ LOGP(DDB, LOGL_ERROR, "Unable to set Write-Ahead Logging: %s\n",
+ err_msg);
+
/* prepare all SQL statements */
for (i = 0; i < ARRAY_SIZE(dbc->stmt); i++) {
rc = sqlite3_prepare_v2(dbc->db, stmt_sql[i], -1,