diff OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4591:ff8170d17d90 db-changes

moving all accesses to databases from IDatabaseWrapper to ITransaction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Mar 2021 15:30:42 +0100
parents 671ee7c1fd46
children cc64385593ef
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Fri Mar 12 16:04:09 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Mon Mar 15 15:30:42 2021 +0100
@@ -65,6 +65,7 @@
 #include "../../../OrthancFramework/Sources/SerializationToolbox.h"
 #include "../../../OrthancFramework/Sources/StringMemoryBuffer.h"
 #include "../../../OrthancFramework/Sources/Toolbox.h"
+#include "../../Sources/Database/VoidDatabaseListener.h"
 #include "../../Sources/OrthancConfiguration.h"
 #include "../../Sources/OrthancFindRequestHandler.h"
 #include "../../Sources/Search/HierarchicalMatcher.h"
@@ -4970,8 +4971,16 @@
                                  "The service ReconstructMainDicomTags can only be invoked by custom database plugins");
         }
 
-        IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea);
-        ServerToolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level));
+        VoidDatabaseListener listener;
+        
+        {
+          IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea);
+
+          std::unique_ptr<IDatabaseWrapper::ITransaction> transaction(
+            pimpl_->database_->StartTransaction(TransactionType_ReadWrite, listener));
+          ServerToolbox::ReconstructMainDicomTags(*transaction, storage, Plugins::Convert(p.level));
+          transaction->Commit(0);
+        }
 
         return true;
       }