# HG changeset patch # User Sebastien Jodogne # Date 1730209589 0 # Node ID 70a879a7b6588620a2ce9ba0150b1b0237c6d3dc # Parent c1b9eb21bd61d1630ff640a1aaaa4f3e8b8e7318 introduction of IDatabaseWrapper::ICompatibilityTransaction diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -49,7 +49,8 @@ public Compatibility::IGetChildrenMetadata, public Compatibility::ILookupResources, public Compatibility::ILookupResourceAndParent, - public Compatibility::ISetResourcesContent + public Compatibility::ISetResourcesContent, + public IDatabaseWrapper::ICompatibilityTransaction { private: typedef std::pair AnswerResource; @@ -806,10 +807,10 @@ } - virtual void GetAllPublicIds(std::list& target, - ResourceType resourceType, - int64_t since, - uint32_t limit) ORTHANC_OVERRIDE + virtual void GetAllPublicIdsCompatibility(std::list& target, + ResourceType resourceType, + int64_t since, + uint32_t limit) ORTHANC_OVERRIDE { if (that_.extensions_.getAllPublicIdsWithLimit != NULL) { diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -46,7 +46,9 @@ namespace Orthanc { - class OrthancPluginDatabaseV3::Transaction : public BaseDatabaseWrapper::BaseTransaction + class OrthancPluginDatabaseV3::Transaction : + public BaseDatabaseWrapper::BaseTransaction, + public IDatabaseWrapper::ICompatibilityTransaction { private: OrthancPluginDatabaseV3& that_; @@ -386,10 +388,10 @@ } - virtual void GetAllPublicIds(std::list& target, - ResourceType resourceType, - int64_t since, - uint32_t limit) ORTHANC_OVERRIDE + virtual void GetAllPublicIdsCompatibility(std::list& target, + ResourceType resourceType, + int64_t since, + uint32_t limit) ORTHANC_OVERRIDE { CheckSuccess(that_.backend_.getAllPublicIdsWithLimit( transaction_, Plugins::Convert(resourceType), diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -398,7 +398,9 @@ } - class OrthancPluginDatabaseV4::Transaction : public IDatabaseWrapper::ITransaction + class OrthancPluginDatabaseV4::Transaction : + public IDatabaseWrapper::ITransaction, + public IDatabaseWrapper::ICompatibilityTransaction { private: OrthancPluginDatabaseV4& database_; @@ -673,10 +675,10 @@ } - virtual void GetAllPublicIds(std::list& target, - ResourceType resourceType, - int64_t since, - uint32_t limit) ORTHANC_OVERRIDE + virtual void GetAllPublicIdsCompatibility(std::list& target, + ResourceType resourceType, + int64_t since, + uint32_t limit) ORTHANC_OVERRIDE { DatabasePluginMessages::TransactionRequest request; request.mutable_get_all_public_ids_with_limits()->set_resource_type(Convert(resourceType)); @@ -1762,7 +1764,7 @@ } else { - Compatibility::GenericFind find(*this); + Compatibility::GenericFind find(*this, *this); find.ExecuteFind(identifiers, capabilities, request); } } @@ -1780,7 +1782,7 @@ } else { - Compatibility::GenericFind find(*this); + Compatibility::GenericFind find(*this, *this); find.ExecuteExpand(response, capabilities, request, identifier); } } diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -77,7 +77,7 @@ const Capabilities& capabilities, const FindRequest& request) { - Compatibility::GenericFind find(*this); + Compatibility::GenericFind find(*this, *this); find.ExecuteFind(identifiers, capabilities, request); } @@ -87,7 +87,7 @@ const FindRequest& request, const std::string& identifier) { - Compatibility::GenericFind find(*this); + Compatibility::GenericFind find(*this, *this); find.ExecuteExpand(response, capabilities, request, identifier); } diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/BaseDatabaseWrapper.h --- a/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/BaseDatabaseWrapper.h Tue Oct 29 13:46:29 2024 +0000 @@ -34,7 +34,9 @@ class BaseDatabaseWrapper : public IDatabaseWrapper { public: - class BaseTransaction : public IDatabaseWrapper::ITransaction + class BaseTransaction : + public IDatabaseWrapper::ITransaction, + public IDatabaseWrapper::ICompatibilityTransaction { public: virtual int64_t IncrementGlobalProperty(GlobalProperty property, diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/Compatibility/GenericFind.cpp --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -140,7 +140,7 @@ } else if (request.GetLimitsCount() != 0) { - transaction_.GetAllPublicIds(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); + compatibilityTransaction_.GetAllPublicIdsCompatibility(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); } else { diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/Compatibility/GenericFind.h --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.h Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.h Tue Oct 29 13:46:29 2024 +0000 @@ -33,14 +33,17 @@ { private: IDatabaseWrapper::ITransaction& transaction_; + IDatabaseWrapper::ICompatibilityTransaction& compatibilityTransaction_; void RetrieveMainDicomTags(FindResponse::Resource& target, ResourceType level, int64_t internalId); public: - explicit GenericFind(IDatabaseWrapper::ITransaction& transaction) : - transaction_(transaction) + explicit GenericFind(IDatabaseWrapper::ITransaction& transaction, + IDatabaseWrapper::ICompatibilityTransaction& compatibilityTransaction) : + transaction_(transaction), + compatibilityTransaction_(compatibilityTransaction) { } diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/IDatabaseWrapper.h --- a/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/IDatabaseWrapper.h Tue Oct 29 13:46:29 2024 +0000 @@ -202,11 +202,6 @@ virtual void GetAllPublicIds(std::list& target, ResourceType resourceType) = 0; - virtual void GetAllPublicIds(std::list& target, - ResourceType resourceType, - int64_t since, - uint32_t limit) = 0; - virtual void GetChanges(std::list& target /*out*/, bool& done /*out*/, int64_t since, @@ -422,6 +417,21 @@ }; + // TODO-FIND: Could this interface be removed? + class ICompatibilityTransaction : public boost::noncopyable + { + public: + virtual ~ICompatibilityTransaction() + { + } + + virtual void GetAllPublicIdsCompatibility(std::list& target, + ResourceType resourceType, + int64_t since, + uint32_t limit) = 0; + }; + + virtual ~IDatabaseWrapper() { } diff -r c1b9eb21bd61 -r 70a879a7b658 OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Tue Oct 29 13:29:43 2024 +0000 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Tue Oct 29 13:46:29 2024 +0000 @@ -1256,10 +1256,10 @@ } - virtual void GetAllPublicIds(std::list& target, - ResourceType resourceType, - int64_t since, - uint32_t limit) ORTHANC_OVERRIDE + virtual void GetAllPublicIdsCompatibility(std::list& target, + ResourceType resourceType, + int64_t since, + uint32_t limit) ORTHANC_OVERRIDE { SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT publicId FROM Resources WHERE "