Mercurial > hg > orthanc
changeset 5773:3b7dce0e43c6 find-refactoring
handling of case limit=0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Sep 2024 21:21:42 +0200 |
parents | 093a8693ba16 |
children | f96abfe08946 |
files | OrthancServer/Sources/Database/Compatibility/GenericFind.cpp |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed Sep 11 20:49:34 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed Sep 11 21:21:42 2024 +0200 @@ -129,13 +129,30 @@ !request.GetOrthancIdentifiers().HasSeriesId() && !request.GetOrthancIdentifiers().HasInstanceId()) { - if (request.HasLimits()) + if (!request.HasLimits()) + { + transaction_.GetAllPublicIds(identifiers, request.GetLevel()); + } + else if (request.GetLimitsCount() != 0) { transaction_.GetAllPublicIds(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); } else { - transaction_.GetAllPublicIds(identifiers, request.GetLevel()); + // Starting with Orthanc 1.12.5, "limit=0" means "no limit" + std::list<std::string> tmp; + transaction_.GetAllPublicIds(tmp, request.GetLevel()); + + size_t count = 0; + for (std::list<std::string>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) + { + if (count >= request.GetLimitsSince()) + { + identifiers.push_back(*it); + } + + count++; + } } } else if (IsRequestWithoutContraint(request) &&