changeset 5782:f1ccb67fce31 find-refactoring

fix
author Alain Mazy <am@orthanc.team>
date Sat, 14 Sep 2024 11:24:11 +0200
parents dc06dbca0d32
children 56352ae88120
files OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Fri Sep 13 17:33:38 2024 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Sat Sep 14 11:24:11 2024 +0200
@@ -1570,7 +1570,7 @@
 
             for (int i = 0; i < source.one_instance_attachments().size(); i++)
             {
-              FileInfo info(Convert(source.attachments(i)));
+              FileInfo info(Convert(source.one_instance_attachments(i)));
               if (attachments.find(info.GetContentType()) == attachments.end())
               {
                 attachments[info.GetContentType()] = info;
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Fri Sep 13 17:33:38 2024 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Sat Sep 14 11:24:11 2024 +0200
@@ -438,7 +438,7 @@
         LookupFormatter formatter;
         LookupFormatter::Apply(sql, formatter, request);
 
-        sql = "CREATE TEMPORARY TABLE Lookup AS " + sql;
+        sql = "CREATE TEMPORARY TABLE Lookup AS " + sql;   // TODO-FIND: use a CTE
 
         SQLite::Statement statement(db_, sql);
         formatter.Bind(statement);
@@ -595,11 +595,12 @@
         }
       }
 
+      // need one instance info ?
       if (request.GetLevel() != ResourceType_Instance &&
           request.IsRetrieveOneInstanceMetadataAndAttachments())
       {
         {
-          SQLite::Statement s(db_, SQLITE_FROM_HERE, "DROP TABLE IF EXISTS OneInstance");
+          SQLite::Statement s(db_, SQLITE_FROM_HERE, "DROP TABLE IF EXISTS OneInstance");  // TODO-FIND: use a CTE
           s.Run();
         }