Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/Compatibility/DatabaseLookup.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 | d9473bd5ed43 |
children | f0038043fb97 7053502fbf97 |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp Fri Mar 12 16:04:09 2021 +0100 +++ b/OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp Mon Mar 15 15:30:42 2021 +0100 @@ -161,7 +161,7 @@ static void ApplyLevel(SetOfResources& candidates, - IDatabaseWrapper& database, + IDatabaseWrapper::ITransaction& transaction, ILookupResources& compatibility, const std::vector<DatabaseConstraint>& lookup, ResourceType level) @@ -267,7 +267,7 @@ candidate != source.end(); ++candidate) { DicomMap tags; - database.GetMainDicomTags(tags, *candidate); + transaction.GetMainDicomTags(tags, *candidate); bool match = true; @@ -291,7 +291,7 @@ } - static std::string GetOneInstance(IDatabaseWrapper& compatibility, + static std::string GetOneInstance(IDatabaseWrapper::ITransaction& compatibility, int64_t resource, ResourceType level) { @@ -348,11 +348,11 @@ assert(upperLevel <= queryLevel && queryLevel <= lowerLevel); - SetOfResources candidates(database_, upperLevel); + SetOfResources candidates(transaction_, upperLevel); for (int level = upperLevel; level <= lowerLevel; level++) { - ApplyLevel(candidates, database_, compatibility_, lookup, static_cast<ResourceType>(level)); + ApplyLevel(candidates, transaction_, compatibility_, lookup, static_cast<ResourceType>(level)); if (level != lowerLevel) { @@ -372,7 +372,7 @@ it = resources.begin(); it != resources.end(); ++it) { int64_t parent; - if (database_.LookupParent(parent, *it)) + if (transaction_.LookupParent(parent, *it)) { parents.push_back(parent); } @@ -396,9 +396,9 @@ for (std::list<int64_t>::const_iterator it = resources.begin(); it != resources.end(); ++it, pos++) { - assert(database_.GetResourceType(*it) == queryLevel); + assert(transaction_.GetResourceType(*it) == queryLevel); - const std::string resource = database_.GetPublicId(*it); + const std::string resource = transaction_.GetPublicId(*it); resourcesId.push_back(resource); if (instancesId != NULL) @@ -411,7 +411,7 @@ else { // Collect one child instance for each of the selected resources - instancesId->push_back(GetOneInstance(database_, *it, queryLevel)); + instancesId->push_back(GetOneInstance(transaction_, *it, queryLevel)); } } }