summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-05-03 18:50:41 +0200
committerHarald Welte <laforge@gnumonks.org>2016-05-03 18:50:41 +0200
commit2bb6f91a56a730a0423b03906e63430a686b484b (patch)
tree44ea475b99f1baf7f0abef8c289f8be3fe94f588
parent3596f92fadfe55e6262098727fffdb1edfb91a6d (diff)
db: Use Write-Ahead Logging mode of SQLite3
-rw-r--r--osmo-gsup-hlr/src/db.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/osmo-gsup-hlr/src/db.c b/osmo-gsup-hlr/src/db.c
index 4424307..82c901b 100644
--- a/osmo-gsup-hlr/src/db.c
+++ b/osmo-gsup-hlr/src/db.c
@@ -105,6 +105,12 @@ struct db_context *db_open(void *ctx, const char *fname)
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,