# HG changeset patch # User Sebastien Jodogne # Date 1615299917 -3600 # Node ID fb0379abb4a72a2451112ad58eb688ec20239401 # Parent bb3c82b8f373b2615b644ce5d63da6608ca0e21b assume that "GetDatabaseVersion()" can run out of a database transaction diff -r bb3c82b8f373 -r fb0379abb4a7 OrthancServer/Sources/ServerIndex.cpp --- a/OrthancServer/Sources/ServerIndex.cpp Tue Mar 09 15:22:03 2021 +0100 +++ b/OrthancServer/Sources/ServerIndex.cpp Tue Mar 09 15:25:17 2021 +0100 @@ -1879,7 +1879,7 @@ /* out */ uint64_t& dicomUncompressedSize, const std::string& publicId) { - class Operations : public ServerIndex::IReadOnlyOperations + class Operations : public IReadOnlyOperations { private: ResourceType& type_; @@ -1914,7 +1914,7 @@ { } - virtual void Apply(ServerIndex::ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE + virtual void Apply(ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE { int64_t top; if (!transaction.LookupResource(top, type_, publicId_)) @@ -2031,7 +2031,7 @@ query.push_back(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); - class Operations : public ServerIndex::IReadOnlyOperations + class Operations : public IReadOnlyOperations { private: std::vector& result_; @@ -2271,26 +2271,6 @@ } - unsigned int ServerIndex::GetDatabaseVersion() - { - class Operations : public ReadOnlyOperationsT1 - { - public: - virtual void ApplyTuple(ReadOnlyTransaction& transaction, - const Tuple& tuple) ORTHANC_OVERRIDE - { - // TODO - CANDIDATE FOR "TransactionType_Implicit" - tuple.get<0>() = transaction.GetDatabaseVersion(); - } - }; - - unsigned int version; - Operations operations; - operations.Apply(*this, version); - return version; - } - - bool ServerIndex::LookupParent(std::string& target, const std::string& publicId, ResourceType parentType) diff -r bb3c82b8f373 -r fb0379abb4a7 OrthancServer/Sources/ServerIndex.h --- a/OrthancServer/Sources/ServerIndex.h Tue Mar 09 15:22:03 2021 +0100 +++ b/OrthancServer/Sources/ServerIndex.h Tue Mar 09 15:25:17 2021 +0100 @@ -108,6 +108,13 @@ // "count == 0" means no limit on the number of patients void SetMaximumPatientCount(unsigned int count); + // It is assumed that "GetDatabaseVersion()" can run out of a + // database transaction + unsigned int GetDatabaseVersion() + { + return db_.GetDatabaseVersion(); + } + /*** @@ -190,11 +197,6 @@ db_.GetChildrenPublicId(target, id); } - unsigned int GetDatabaseVersion() - { - return db_.GetDatabaseVersion(); - } - void GetExportedResources(std::list& target /*out*/, bool& done /*out*/, int64_t since, @@ -537,8 +539,6 @@ bool LookupResourceType(ResourceType& type, const std::string& publicId); - unsigned int GetDatabaseVersion(); - bool LookupParent(std::string& target, const std::string& publicId, ResourceType parentType);