# HG changeset patch # User Alain Mazy # Date 1725631458 -7200 # Node ID d52b3f394f692bfa659998795f540e6c95686e46 # Parent 0b44920843b57b620f1babef816ce4a0efa13adf FormatLimits (SQLServer needs custom code) diff -r 0b44920843b5 -r d52b3f394f69 OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Fri Sep 06 15:21:54 2024 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Fri Sep 06 16:04:18 2024 +0200 @@ -65,6 +65,21 @@ return "ESCAPE '\\'"; } + virtual std::string FormatLimits(uint64_t since, uint64_t count) ORTHANC_OVERRIDE + { + std::string sql; + if (count > 0) + { + sql += " LIMIT " + boost::lexical_cast(count); + } + if (since > 0) + { + sql += " OFFSET " + boost::lexical_cast(since); + } + + return sql; + } + virtual bool IsEscapeBrackets() const ORTHANC_OVERRIDE { return false; diff -r 0b44920843b5 -r d52b3f394f69 OrthancServer/Sources/Search/ISqlLookupFormatter.cpp --- a/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp Fri Sep 06 15:21:54 2024 +0200 +++ b/OrthancServer/Sources/Search/ISqlLookupFormatter.cpp Fri Sep 06 16:04:18 2024 +0200 @@ -752,14 +752,7 @@ if (request.HasLimits()) { - if (request.GetLimitsCount() > 0) - { - sql += " LIMIT " + boost::lexical_cast(request.GetLimitsCount()); - } - if (request.GetLimitsSince() > 0) - { - sql += " OFFSET " + boost::lexical_cast(request.GetLimitsSince()); - } + sql += formatter.FormatLimits(request.GetLimitsSince(), request.GetLimitsCount()); } } diff -r 0b44920843b5 -r d52b3f394f69 OrthancServer/Sources/Search/ISqlLookupFormatter.h --- a/OrthancServer/Sources/Search/ISqlLookupFormatter.h Fri Sep 06 15:21:54 2024 +0200 +++ b/OrthancServer/Sources/Search/ISqlLookupFormatter.h Fri Sep 06 16:04:18 2024 +0200 @@ -58,6 +58,8 @@ virtual std::string FormatWildcardEscape() = 0; + virtual std::string FormatLimits(uint64_t since, uint64_t count) = 0; + /** * Whether to escape '[' and ']', which is only needed for * MSSQL. New in Orthanc 1.10.0, from the following changeset: