changeset 374:42e87c17cab8

some refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Apr 2013 17:00:26 +0200
parents 7000726bade7
children d1ea72f1c967
files Core/SQLite/Connection.cpp OrthancServer/DatabaseWrapper.cpp
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Core/SQLite/Connection.cpp	Mon Mar 25 12:12:37 2013 +0100
+++ b/Core/SQLite/Connection.cpp	Mon Apr 15 17:00:26 2013 +0200
@@ -88,15 +88,7 @@
       // Execute PRAGMAs at this point
       // http://www.sqlite.org/pragma.html
       Execute("PRAGMA FOREIGN_KEYS=ON;");
-
       Execute("PRAGMA RECURSIVE_TRIGGERS=ON;");
-
-      // Performance tuning
-      Execute("PRAGMA SYNCHRONOUS=NORMAL;");
-      Execute("PRAGMA JOURNAL_MODE=WAL;");
-      Execute("PRAGMA LOCKING_MODE=EXCLUSIVE;");
-      Execute("PRAGMA WAL_AUTOCHECKPOINT=1000;");
-      //Execute("PRAGMA TEMP_STORE=memory");
     }
 
     void Connection::OpenInMemory()
--- a/OrthancServer/DatabaseWrapper.cpp	Mon Mar 25 12:12:37 2013 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Mon Apr 15 17:00:26 2013 +0200
@@ -750,6 +750,14 @@
 
   void DatabaseWrapper::Open()
   {
+    // Performance tuning of SQLite with PRAGMAs
+    // http://www.sqlite.org/pragma.html
+    db_.Execute("PRAGMA SYNCHRONOUS=NORMAL;");
+    db_.Execute("PRAGMA JOURNAL_MODE=WAL;");
+    db_.Execute("PRAGMA LOCKING_MODE=EXCLUSIVE;");
+    db_.Execute("PRAGMA WAL_AUTOCHECKPOINT=1000;");
+    //db_.Execute("PRAGMA TEMP_STORE=memory");
+
     if (!db_.DoesTableExist("GlobalProperties"))
     {
       LOG(INFO) << "Creating the database";