comparison OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp @ 4623:95ffe3b6ef7c db-changes

handling of revisions for metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Apr 2021 17:13:03 +0200
parents f75c63aa9de0
children f7d5372b59b3
comparison
equal deleted inserted replaced
4622:9086aeb9d9d2 4623:95ffe3b6ef7c
848 } 848 }
849 } 849 }
850 850
851 851
852 virtual bool LookupMetadata(std::string& target, 852 virtual bool LookupMetadata(std::string& target,
853 int64_t& revision,
853 int64_t id, 854 int64_t id,
854 MetadataType type) ORTHANC_OVERRIDE 855 MetadataType type) ORTHANC_OVERRIDE
855 { 856 {
856 SQLite::Statement s(db_, SQLITE_FROM_HERE, 857 SQLite::Statement s(db_, SQLITE_FROM_HERE,
857 "SELECT value FROM Metadata WHERE id=? AND type=?"); 858 "SELECT value FROM Metadata WHERE id=? AND type=?");
863 return false; 864 return false;
864 } 865 }
865 else 866 else
866 { 867 {
867 target = s.ColumnString(0); 868 target = s.ColumnString(0);
869 revision = 0; // TODO - REVISIONS
868 return true; 870 return true;
869 } 871 }
870 } 872 }
871 873
872 874
1031 } 1033 }
1032 1034
1033 1035
1034 virtual void SetMetadata(int64_t id, 1036 virtual void SetMetadata(int64_t id,
1035 MetadataType type, 1037 MetadataType type,
1036 const std::string& value) ORTHANC_OVERRIDE 1038 const std::string& value,
1037 { 1039 int64_t revision) ORTHANC_OVERRIDE
1040 {
1041 // TODO - REVISIONS
1038 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT OR REPLACE INTO Metadata VALUES(?, ?, ?)"); 1042 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT OR REPLACE INTO Metadata VALUES(?, ?, ?)");
1039 s.BindInt64(0, id); 1043 s.BindInt64(0, id);
1040 s.BindInt(1, type); 1044 s.BindInt(1, type);
1041 s.BindString(2, value); 1045 s.BindString(2, value);
1042 s.Run(); 1046 s.Run();