Mercurial > hg > orthanc
comparison OrthancServer/Database/SQLiteDatabaseWrapper.cpp @ 3105:2e1711f80f74 db-changes
More consistent handling of the "Last" field returned by the "/changes" URI
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jan 2019 18:02:34 +0100 |
parents | 2e1808b6146a |
children | 0fa7181ac4e5 |
comparison
equal
deleted
inserted
replaced
3101:b2b6db5ad9a5 | 3105:2e1711f80f74 |
---|---|
1268 { | 1268 { |
1269 resourcesId.push_back(s.ColumnString(0)); | 1269 resourcesId.push_back(s.ColumnString(0)); |
1270 } | 1270 } |
1271 } | 1271 } |
1272 } | 1272 } |
1273 | |
1274 | |
1275 int64_t SQLiteDatabaseWrapper::GetLastChangeIndex() | |
1276 { | |
1277 SQLite::Statement s(db_, SQLITE_FROM_HERE, | |
1278 "SELECT seq FROM sqlite_sequence WHERE name='Changes'"); | |
1279 | |
1280 if (s.Step()) | |
1281 { | |
1282 int64_t c = s.ColumnInt(0); | |
1283 assert(!s.Step()); | |
1284 return c; | |
1285 } | |
1286 else | |
1287 { | |
1288 // No change has been recorded so far in the database | |
1289 return 0; | |
1290 } | |
1291 } | |
1273 } | 1292 } |