changeset 314:64763998cdff

clarification in IndexBackend::SignalDeletedFiles()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Jul 2021 17:17:23 +0200
parents 8bb2eb006e21
children 11641063ddb2
files Framework/Plugins/IndexBackend.cpp Framework/Plugins/IndexUnitTests.h
diffstat 2 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Wed Jul 14 15:56:37 2021 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Wed Jul 14 17:17:23 2021 +0200
@@ -201,24 +201,21 @@
   {
     DatabaseManager::CachedStatement statement(
       STATEMENT_FROM_HERE, manager,
-      "SELECT * FROM DeletedFiles");
+      "SELECT uuid, fileType, uncompressedSize, uncompressedHash, compressionType, "
+      "compressedSize, compressedHash FROM DeletedFiles");
 
     statement.SetReadOnly(true);
     statement.Execute();
 
     while (!statement.IsDone())
     {
-      std::string a = statement.ReadString(0);
-      std::string b = statement.ReadString(5);
-      std::string c = statement.ReadString(6);
-
-      output.SignalDeletedAttachment(a.c_str(),
+      output.SignalDeletedAttachment(statement.ReadString(0),
                                      statement.ReadInteger32(1),
-                                     statement.ReadInteger64(3),
-                                     b.c_str(),
+                                     statement.ReadInteger64(2),
+                                     statement.ReadString(3),
                                      statement.ReadInteger32(4),
-                                     statement.ReadInteger64(2),
-                                     c.c_str());
+                                     statement.ReadInteger64(5),
+                                     statement.ReadString(6));
       
       statement.Next();
     }
--- a/Framework/Plugins/IndexUnitTests.h	Wed Jul 14 15:56:37 2021 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Wed Jul 14 17:17:23 2021 +0200
@@ -675,6 +675,8 @@
       a.compressedSize = 4242;
       a.compressedHash = "md5";
       db.AddAttachment(*manager, resources[attachmentLevel], a, 42);
+
+      ASSERT_THROW(db.AddAttachment(*manager, resources[attachmentLevel], a, 43), Orthanc::OrthancException);
       
       deletedAttachments.clear();
       a.uuid = "attachment2";