comparison OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp @ 4627:f7d5372b59b3 db-changes

handling revisions of attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Apr 2021 15:11:59 +0200
parents 95ffe3b6ef7c
children f0038043fb97 b8fcd331b4b3
comparison
equal deleted inserted replaced
4626:686f189a903d 4627:f7d5372b59b3
324 return listener_; 324 return listener_;
325 } 325 }
326 326
327 327
328 virtual void AddAttachment(int64_t id, 328 virtual void AddAttachment(int64_t id,
329 const FileInfo& attachment) ORTHANC_OVERRIDE 329 const FileInfo& attachment,
330 { 330 int64_t revision) ORTHANC_OVERRIDE
331 {
332 // TODO - REVISIONS
331 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO AttachedFiles VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); 333 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO AttachedFiles VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
332 s.BindInt64(0, id); 334 s.BindInt64(0, id);
333 s.BindInt(1, attachment.GetContentType()); 335 s.BindInt(1, attachment.GetContentType());
334 s.BindString(2, attachment.GetUuid()); 336 s.BindString(2, attachment.GetUuid());
335 s.BindInt64(3, attachment.GetCompressedSize()); 337 s.BindInt64(3, attachment.GetCompressedSize());
797 s.Run(); 799 s.Run();
798 } 800 }
799 801
800 802
801 virtual bool LookupAttachment(FileInfo& attachment, 803 virtual bool LookupAttachment(FileInfo& attachment,
804 int64_t& revision,
802 int64_t id, 805 int64_t id,
803 FileContentType contentType) ORTHANC_OVERRIDE 806 FileContentType contentType) ORTHANC_OVERRIDE
804 { 807 {
805 SQLite::Statement s(db_, SQLITE_FROM_HERE, 808 SQLite::Statement s(db_, SQLITE_FROM_HERE,
806 "SELECT uuid, uncompressedSize, compressionType, compressedSize, " 809 "SELECT uuid, uncompressedSize, compressionType, compressedSize, "
819 s.ColumnInt64(1), 822 s.ColumnInt64(1),
820 s.ColumnString(4), 823 s.ColumnString(4),
821 static_cast<CompressionType>(s.ColumnInt(2)), 824 static_cast<CompressionType>(s.ColumnInt(2)),
822 s.ColumnInt64(3), 825 s.ColumnInt64(3),
823 s.ColumnString(5)); 826 s.ColumnString(5));
827 revision = 0; // TODO - REVISIONS
824 return true; 828 return true;
825 } 829 }
826 } 830 }
827 831
828 832