changeset 643:77004b16d7fe

Now returning results when e.g, ordering instances against a metadata they don't have
author Alain Mazy <am@orthanc.team>
date Thu, 20 Feb 2025 11:54:14 +0100 (3 months ago)
parents cfddeec356c5
children 3657d84703b9
files Framework/Plugins/ISqlLookupFormatter.cpp PostgreSQL/NEWS
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/ISqlLookupFormatter.cpp	Fri Feb 14 15:36:41 2025 +0100
+++ b/Framework/Plugins/ISqlLookupFormatter.cpp	Thu Feb 20 11:54:14 2025 +0100
@@ -440,26 +440,26 @@
 
     if (tagLevel == requestLevel)
     {
-      target = " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) +
+      target = " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) +
                 ".internalId AND " + tagFilter;
     }
     else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 1)
     {
       target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId "
-               " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter;
+               " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter;
     }
     else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 2)
     {
       target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId "
                " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId "
-               " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter;
+               " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter;
     }
     else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 3)
     {
       target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId "
                " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId "
                " INNER JOIN Resources " + orderArg + "grandgrandparent ON " + orderArg + "grandgrandparent.internalId = " + orderArg + "grandparent.parentId "
-               " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter;
+               " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter;
     }
   }
 #endif
@@ -473,7 +473,7 @@
   {
     std::string arg = "order" + boost::lexical_cast<std::string>(index);
 
-    target = " INNER JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) +
+    target = " FULL JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) +
              ".internalId AND " + arg + ".type = " +
              boost::lexical_cast<std::string>(metadata);
   }
--- a/PostgreSQL/NEWS	Fri Feb 14 15:36:41 2025 +0100
+++ b/PostgreSQL/NEWS	Thu Feb 20 11:54:14 2025 +0100
@@ -22,6 +22,7 @@
 * Fixed high memory usage due to caching of too many
   prepared SQL statement when using since & limit.
 * Removed duplicate comparison in find SQL queries.
+* Now returning results when e.g, ordering instances against a metadata they don't have.