Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5850:1980354c8113 find-refactoring
add level of interest to StatelessDatabaseOperations::LookupAttachment()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2024 15:03:32 +0000 |
parents | c1b9eb21bd61 |
children | ea547160f27e |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Oct 29 14:05:59 2024 +0000 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Oct 29 15:03:32 2024 +0000 @@ -610,10 +610,11 @@ bool StatelessDatabaseOperations::LookupAttachment(FileInfo& attachment, int64_t& revision, + ResourceType level, const std::string& instancePublicId, FileContentType contentType) { - class Operations : public ReadOnlyOperationsT5<bool&, FileInfo&, int64_t&, const std::string&, FileContentType> + class Operations : public ReadOnlyOperationsT6<bool&, FileInfo&, int64_t&, const std::string&, FileContentType, ResourceType> { public: virtual void ApplyTuple(ReadOnlyTransaction& transaction, @@ -625,7 +626,13 @@ { throw OrthancException(ErrorCode_UnknownResource); } - else if (transaction.LookupAttachment(tuple.get<1>(), tuple.get<2>(), internalId, tuple.get<4>())) + + if (type != tuple.get<5>()) + { + throw OrthancException(ErrorCode_DatabasePlugin); + } + + if (transaction.LookupAttachment(tuple.get<1>(), tuple.get<2>(), internalId, tuple.get<4>())) { assert(tuple.get<1>().GetContentType() == tuple.get<4>()); tuple.get<0>() = true; @@ -639,7 +646,7 @@ bool found; Operations operations; - operations.Apply(*this, found, attachment, revision, instancePublicId, contentType); + operations.Apply(*this, found, attachment, revision, instancePublicId, contentType, level); return found; }