diff PostgreSQL/Plugins/PostgreSQLIndex.cpp @ 12:41543239072d

transactions for storage area
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Jul 2018 18:34:56 +0200
parents 7cea966b6829
children 927264a0c137
line wrap: on
line diff
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Jul 09 11:45:52 2018 +0200
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Mon Jul 09 18:34:56 2018 +0200
@@ -66,6 +66,11 @@
 
     db->Open();
 
+    if (parameters_.HasLock())
+    {
+      db->AdvisoryLock(42 /* some arbitrary constant */);
+    }
+
     if (clearAll_)
     {
       db->ClearAll();
@@ -87,12 +92,6 @@
         SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 0);
       }
           
-      t.Commit();
-    }
-
-    {
-      PostgreSQLTransaction t(*db);
-
       if (!db->DoesTableExist("Resources"))
       {
         LOG(ERROR) << "Corrupted PostgreSQL database";