diff OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp @ 4623:95ffe3b6ef7c db-changes

handling of revisions for metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Apr 2021 17:13:03 +0200
parents f75c63aa9de0
children f7d5372b59b3
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Fri Apr 16 10:48:57 2021 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp	Fri Apr 16 17:13:03 2021 +0200
@@ -772,7 +772,8 @@
             MetadataType type = static_cast<MetadataType>(*it);
 
             std::string value;
-            if (LookupMetadata(value, id, type))
+            int64_t revision;  // Ignored
+            if (LookupMetadata(value, revision, id, type))
             {
               target[type] = value;
             }
@@ -1174,11 +1175,13 @@
 
 
     virtual bool LookupMetadata(std::string& target,
+                                int64_t& revision,
                                 int64_t id,
                                 MetadataType type) ORTHANC_OVERRIDE
     {
       ResetAnswers();
       CheckSuccess(that_.backend_.lookupMetadata(that_.GetContext(), that_.payload_, id, static_cast<int32_t>(type)));
+      revision = 0;  // Dummy value, as revisions were added in Orthanc 1.9.2
       return ForwardSingleAnswer(target);
     }
 
@@ -1336,8 +1339,10 @@
 
     virtual void SetMetadata(int64_t id,
                              MetadataType type,
-                             const std::string& value) ORTHANC_OVERRIDE
+                             const std::string& value,
+                             int64_t revision) ORTHANC_OVERRIDE
     {
+      // "revision" is not used, as it was added in Orthanc 1.9.2
       CheckSuccess(that_.backend_.setMetadata
                    (that_.payload_, id, static_cast<int32_t>(type), value.c_str()));
     }