Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp @ 5213:055428d92772 db-protobuf
clarifying types of since/limit in IDatabaseWrapper
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Apr 2023 11:18:55 +0200 |
parents | 1a878922404b |
children | 450ac804d3af |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Mon Apr 03 10:30:15 2023 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Mon Apr 03 11:18:55 2023 +0200 @@ -233,11 +233,11 @@ void GetChangesInternal(std::list<ServerIndexChange>& target, bool& done, SQLite::Statement& s, - uint32_t maxResults) + uint32_t limit) { target.clear(); - while (target.size() < maxResults && s.Step()) + while (target.size() < limit && s.Step()) { int64_t seq = s.ColumnInt64(0); ChangeType changeType = static_cast<ChangeType>(s.ColumnInt(1)); @@ -250,18 +250,18 @@ target.push_back(ServerIndexChange(seq, changeType, resourceType, publicId, date)); } - done = !(target.size() == maxResults && s.Step()); + done = !(target.size() == limit && s.Step()); } void GetExportedResourcesInternal(std::list<ExportedResource>& target, bool& done, SQLite::Statement& s, - uint32_t maxResults) + uint32_t limit) { target.clear(); - while (target.size() < maxResults && s.Step()) + while (target.size() < limit && s.Step()) { int64_t seq = s.ColumnInt64(0); ResourceType resourceType = static_cast<ResourceType>(s.ColumnInt(1)); @@ -280,7 +280,7 @@ target.push_back(resource); } - done = !(target.size() == maxResults && s.Step()); + done = !(target.size() == limit && s.Step()); } @@ -341,7 +341,7 @@ std::list<std::string>* instancesId, const std::vector<DatabaseConstraint>& lookup, ResourceType queryLevel, - size_t limit) ORTHANC_OVERRIDE + uint32_t limit) ORTHANC_OVERRIDE { LookupFormatter formatter; @@ -509,8 +509,8 @@ virtual void GetAllPublicIds(std::list<std::string>& target, ResourceType resourceType, - size_t since, - size_t limit) ORTHANC_OVERRIDE + int64_t since, + uint32_t limit) ORTHANC_OVERRIDE { if (limit == 0) { @@ -536,12 +536,12 @@ virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, bool& done /*out*/, int64_t since, - uint32_t maxResults) ORTHANC_OVERRIDE + uint32_t limit) ORTHANC_OVERRIDE { SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT * FROM Changes WHERE seq>? ORDER BY seq LIMIT ?"); s.BindInt64(0, since); - s.BindInt(1, maxResults + 1); - GetChangesInternal(target, done, s, maxResults); + s.BindInt(1, limit + 1); + GetChangesInternal(target, done, s, limit); } @@ -588,13 +588,13 @@ virtual void GetExportedResources(std::list<ExportedResource>& target, bool& done, int64_t since, - uint32_t maxResults) ORTHANC_OVERRIDE + uint32_t limit) ORTHANC_OVERRIDE { SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT * FROM ExportedResources WHERE seq>? ORDER BY seq LIMIT ?"); s.BindInt64(0, since); - s.BindInt(1, maxResults + 1); - GetExportedResourcesInternal(target, done, s, maxResults); + s.BindInt(1, limit + 1); + GetExportedResourcesInternal(target, done, s, limit); }