comparison 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
comparison
equal deleted inserted replaced
4590:4a0bf1019335 4591:ff8170d17d90
63 #include "../../../OrthancFramework/Sources/MetricsRegistry.h" 63 #include "../../../OrthancFramework/Sources/MetricsRegistry.h"
64 #include "../../../OrthancFramework/Sources/OrthancException.h" 64 #include "../../../OrthancFramework/Sources/OrthancException.h"
65 #include "../../../OrthancFramework/Sources/SerializationToolbox.h" 65 #include "../../../OrthancFramework/Sources/SerializationToolbox.h"
66 #include "../../../OrthancFramework/Sources/StringMemoryBuffer.h" 66 #include "../../../OrthancFramework/Sources/StringMemoryBuffer.h"
67 #include "../../../OrthancFramework/Sources/Toolbox.h" 67 #include "../../../OrthancFramework/Sources/Toolbox.h"
68 #include "../../Sources/Database/VoidDatabaseListener.h"
68 #include "../../Sources/OrthancConfiguration.h" 69 #include "../../Sources/OrthancConfiguration.h"
69 #include "../../Sources/OrthancFindRequestHandler.h" 70 #include "../../Sources/OrthancFindRequestHandler.h"
70 #include "../../Sources/Search/HierarchicalMatcher.h" 71 #include "../../Sources/Search/HierarchicalMatcher.h"
71 #include "../../Sources/ServerContext.h" 72 #include "../../Sources/ServerContext.h"
72 #include "../../Sources/ServerToolbox.h" 73 #include "../../Sources/ServerToolbox.h"
4968 { 4969 {
4969 throw OrthancException(ErrorCode_DatabasePlugin, 4970 throw OrthancException(ErrorCode_DatabasePlugin,
4970 "The service ReconstructMainDicomTags can only be invoked by custom database plugins"); 4971 "The service ReconstructMainDicomTags can only be invoked by custom database plugins");
4971 } 4972 }
4972 4973
4973 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea); 4974 VoidDatabaseListener listener;
4974 ServerToolbox::ReconstructMainDicomTags(*pimpl_->database_, storage, Plugins::Convert(p.level)); 4975
4976 {
4977 IStorageArea& storage = *reinterpret_cast<IStorageArea*>(p.storageArea);
4978
4979 std::unique_ptr<IDatabaseWrapper::ITransaction> transaction(
4980 pimpl_->database_->StartTransaction(TransactionType_ReadWrite, listener));
4981 ServerToolbox::ReconstructMainDicomTags(*transaction, storage, Plugins::Convert(p.level));
4982 transaction->Commit(0);
4983 }
4975 4984
4976 return true; 4985 return true;
4977 } 4986 }
4978 4987
4979 case _OrthancPluginService_GenerateRestApiAuthorizationToken: 4988 case _OrthancPluginService_GenerateRestApiAuthorizationToken: