comparison OrthancServer/Database/SQLiteDatabaseWrapper.cpp @ 3124:c0d7aee8c3f8 db-changes

Fix issue #58 (Patient recycling order should be defined by their received last instance)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 Jan 2019 21:09:33 +0100
parents f86ebf971a72
children 4bbadcd03966
comparison
equal deleted inserted replaced
3121:f86ebf971a72 3124:c0d7aee8c3f8
1321 return 0; 1321 return 0;
1322 } 1322 }
1323 } 1323 }
1324 1324
1325 1325
1326 void SQLiteDatabaseWrapper::TagAsMostRecentPatient(int64_t patient) 1326 void SQLiteDatabaseWrapper::TagMostRecentPatient(int64_t patient)
1327 { 1327 {
1328 // TODO 1328 {
1329 SQLite::Statement s(db_, SQLITE_FROM_HERE,
1330 "DELETE FROM PatientRecyclingOrder WHERE patientId=?");
1331 s.BindInt64(0, patient);
1332 s.Run();
1333
1334 assert(db_.GetLastChangeCount() == 0 ||
1335 db_.GetLastChangeCount() == 1);
1336
1337 if (db_.GetLastChangeCount() == 0)
1338 {
1339 // The patient was protected, there was nothing to delete from the recycling order
1340 return;
1341 }
1342 }
1343
1344 {
1345 SQLite::Statement s(db_, SQLITE_FROM_HERE,
1346 "INSERT INTO PatientRecyclingOrder VALUES(NULL, ?)");
1347 s.BindInt64(0, patient);
1348 s.Run();
1349 }
1329 } 1350 }
1330 } 1351 }