changeset 664:48460f653628 attach-custom-data

fix
author Alain Mazy <am@orthanc.team>
date Wed, 21 May 2025 23:42:55 +0200
parents 41994c49b1f0
children 3ef7ca114790
files Framework/Plugins/IndexBackend.cpp Framework/PostgreSQL/PostgreSQLStatement.cpp
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Wed May 21 23:42:49 2025 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Wed May 21 23:42:55 2025 +0200
@@ -400,7 +400,7 @@
     }
     else
     {
-      args.SetNullValue("custom-data");
+      args.SetUtf8NullValue("custom-data");
     }
 
     statement.Execute(args);
@@ -4454,7 +4454,7 @@
       {
         statement.reset(new DatabaseManager::CachedStatement(
                         STATEMENT_FROM_HERE, manager,
-                        "SELECT key, value FROM KeyValueStores WHERE storeId= " + storeIdParameter + " ORDER BY ASC " + formatter.FormatLimits(0, request.limit())));
+                        "SELECT key, value FROM KeyValueStores WHERE storeId= " + storeIdParameter + " ORDER BY key ASC " + formatter.FormatLimits(0, request.limit())));
       }
       else
       {
@@ -4462,7 +4462,7 @@
 
         statement.reset(new DatabaseManager::CachedStatement(
                         STATEMENT_FROM_HERE, manager,
-                        "SELECT key, value FROM KeyValueStores WHERE storeId= " + storeIdParameter + " AND key > " + fromKeyParameter + " ORDER BY ASC " + formatter.FormatLimits(0, request.limit())));
+                        "SELECT key, value FROM KeyValueStores WHERE storeId= " + storeIdParameter + " AND key > " + fromKeyParameter + " ORDER BY key ASC " + formatter.FormatLimits(0, request.limit())));
       }
         
       statement->Execute(formatter.GetDictionary());
@@ -4525,13 +4525,13 @@
       {
         statement.reset(new DatabaseManager::CachedStatement(
                         STATEMENT_FROM_HERE, manager,
-                        "SELECT id, value FROM Queues WHERE storeId= " + queueIdParameter + " ORDER BY ASC " + formatter.FormatLimits(0, 1)));
+                        "SELECT id, value FROM Queues WHERE storeId= " + queueIdParameter + " ORDER BY id ASC " + formatter.FormatLimits(0, 1)));
       }
       else
       {
         statement.reset(new DatabaseManager::CachedStatement(
                         STATEMENT_FROM_HERE, manager,
-                        "SELECT id, value FROM Queues WHERE storeId= " + queueIdParameter + " ORDER BY DESC " + formatter.FormatLimits(0, 1)));
+                        "SELECT id, value FROM Queues WHERE storeId= " + queueIdParameter + " ORDER BY id DESC " + formatter.FormatLimits(0, 1)));
       }
         
       statement->Execute(formatter.GetDictionary());
--- a/Framework/PostgreSQL/PostgreSQLStatement.cpp	Wed May 21 23:42:49 2025 +0200
+++ b/Framework/PostgreSQL/PostgreSQLStatement.cpp	Wed May 21 23:42:55 2025 +0200
@@ -530,7 +530,7 @@
       
       const IValue& value = parameters.GetValue(name);
 
-      if (value.GetType() == ValueType_Null)
+      if (value.GetType() == ValueType_Null || value.IsNull())
       {
         BindNull(i);
       }
@@ -539,27 +539,27 @@
         switch (formatter_.GetParameterType(i))
         {
           case ValueType_Integer64:
-            BindInteger64(i, dynamic_cast<const Integer64Value&>(parameters.GetValue(name)).GetValue());
+            BindInteger64(i, dynamic_cast<const Integer64Value&>(value).GetValue());
             break;
 
           case ValueType_Integer32:
-            BindInteger(i, dynamic_cast<const Integer32Value&>(parameters.GetValue(name)).GetValue());
+            BindInteger(i, dynamic_cast<const Integer32Value&>(value).GetValue());
             break;
 
           case ValueType_Utf8String:
             BindString(i, dynamic_cast<const Utf8StringValue&>
-                      (parameters.GetValue(name)).GetContent());
+                      (value).GetContent());
             break;
 
           case ValueType_BinaryString:
             BindString(i, dynamic_cast<const BinaryStringValue&>
-                      (parameters.GetValue(name)).GetContent());
+                      (value).GetContent());
             break;
 
           case ValueType_InputFile:
           {
             const InputFileValue& blob =
-              dynamic_cast<const InputFileValue&>(parameters.GetValue(name));
+              dynamic_cast<const InputFileValue&>(value);
 
             PostgreSQLLargeObject largeObject(database_, blob.GetContent());
             BindLargeObject(i, largeObject);