comparison OrthancServer/DatabaseWrapper.cpp @ 1189:6b9b02a16e99 db-changes

NewChildInstance change type
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Sep 2014 17:02:28 +0200
parents 5b2d8c280ac2
children 1169528a9a5f
comparison
equal deleted inserted replaced
1187:49edef619f1f 1189:6b9b02a16e99
650 void DatabaseWrapper::LogChange(ChangeType changeType, 650 void DatabaseWrapper::LogChange(ChangeType changeType,
651 int64_t internalId, 651 int64_t internalId,
652 ResourceType resourceType, 652 ResourceType resourceType,
653 const std::string& publicId) 653 const std::string& publicId)
654 { 654 {
655 if (changeType == ChangeType_Deleted) 655 if (changeType <= ChangeType_INTERNAL_LastLogged)
656 { 656 {
657 throw OrthancException(ErrorCode_ParameterOutOfRange); 657 const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
658 } 658
659 659 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO Changes VALUES(NULL, ?, ?, ?, ?)");
660 const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 660 s.BindInt(0, changeType);
661 661 s.BindInt64(1, internalId);
662 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO Changes VALUES(NULL, ?, ?, ?, ?)"); 662 s.BindInt(2, resourceType);
663 s.BindInt(0, changeType); 663 s.BindString(3, boost::posix_time::to_iso_string(now));
664 s.BindInt64(1, internalId); 664 s.Run();
665 s.BindInt(2, resourceType); 665 }
666 s.BindString(3, boost::posix_time::to_iso_string(now));
667 s.Run();
668 666
669 listener_.SignalChange(changeType, resourceType, publicId); 667 listener_.SignalChange(changeType, resourceType, publicId);
670 } 668 }
671 669
672 670