From fd8b20290b2ae64fe4c90e251e979c38e5da0545 Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Sat, 4 May 2019 16:24:05 +0200 Subject: [PATCH] Put DB in WAL mode. --- src/common/repository/sqlite/SqliteDatabase.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/repository/sqlite/SqliteDatabase.cxx b/src/common/repository/sqlite/SqliteDatabase.cxx index e349c0c2f..ecc8e3f8c 100644 --- a/src/common/repository/sqlite/SqliteDatabase.cxx +++ b/src/common/repository/sqlite/SqliteDatabase.cxx @@ -74,6 +74,11 @@ void SqliteDatabase::initialize() throw SqliteError("unable to initialize sqlite DB for unknown reason"); }; + + exec("PRAGMA journal_mode=WAL"); + + if (sqlite3_wal_checkpoint_v2(myHandle, nullptr, SQLITE_CHECKPOINT_TRUNCATE, nullptr, nullptr) != SQLITE_OK) + throw SqliteError(sqlite3_errmsg(myHandle)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -