Mercurial > hg > orthanc
diff OrthancServer/DatabaseWrapper.cpp @ 1509:0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Aug 2015 10:01:59 +0200 |
parents | f967bdf8534e |
children | c40fe92a68e7 |
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp Fri Aug 07 20:14:49 2015 +0200 +++ b/OrthancServer/DatabaseWrapper.cpp Mon Aug 10 10:01:59 2015 +0200 @@ -742,6 +742,29 @@ } } + void DatabaseWrapper::GetAllPublicIds(std::list<std::string>& target, + ResourceType resourceType, + size_t since, + size_t limit) + { + if (limit == 0) + { + target.clear(); + return; + } + + SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT publicId FROM Resources WHERE resourceType=? LIMIT ? OFFSET ?"); + s.BindInt(0, resourceType); + s.BindInt64(1, limit); + s.BindInt64(2, since); + + target.clear(); + while (s.Step()) + { + target.push_back(s.ColumnString(0)); + } + } + static void UpgradeDatabase(SQLite::Connection& db, EmbeddedResources::FileResourceId script) {