diff OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp @ 5057:e6f26be401fa

SQLite: close and delete WAL and SHM files on exit (contribution from Sebastian Höffner)
author Alain Mazy <am@osimis.io>
date Tue, 02 Aug 2022 11:38:31 +0200
parents 6eff25f70121
children d7274e43ea7c cc1a8b3ff319
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Thu Jul 14 18:53:24 2022 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Aug 02 11:38:31 2022 +0200
@@ -1371,6 +1371,8 @@
   void SQLiteDatabaseWrapper::Close()
   {
     boost::mutex::scoped_lock lock(mutex_);
+    // close and delete the WAL when exiting properly -> the DB is stored in a single file (no more -wal and -shm files)
+    db_.Execute("PRAGMA JOURNAL_MODE=DELETE;");
     db_.Close();
   }