diff Framework/Plugins/IndexBackend.cpp @ 372:b5e2c1e48828 db-protobuf

created branch db-protobuf to take advantage of OrthancPluginRegisterDatabaseBackendV4()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Mar 2023 11:40:07 +0200
parents 16aac0287485
children be7de633695c
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Tue Mar 14 09:08:45 2023 +0100
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Mar 28 11:40:07 2023 +0200
@@ -35,6 +35,13 @@
 #include <OrthancException.h>
 
 
+#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)         // Macro introduced in Orthanc 1.3.1
+#  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
+#    include "OrthancDatabasePlugin.pb.h"   // Include protobuf messages
+#  endif
+#endif
+
+
 namespace OrthancDatabases
 {
   static std::string ConvertWildcardToLike(const std::string& query)
@@ -2610,8 +2617,6 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
     
-    bool hasLoadedV3 = false;
-      
 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)         // Macro introduced in Orthanc 1.3.1
 #  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
     if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 9, 2) == 1)
@@ -2620,16 +2625,13 @@
                    << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
       
       OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries);
-      hasLoadedV3 = true;
+      return;
     }
 #  endif
 #endif
 
-    if (!hasLoadedV3)
-    {
-      LOG(WARNING) << "Performance warning: Your version of the Orthanc core or SDK doesn't support multiple readers/writers";
-      OrthancDatabases::DatabaseBackendAdapterV2::Register(backend);
-    }
+    LOG(WARNING) << "Performance warning: Your version of the Orthanc core or SDK doesn't support multiple readers/writers";
+    OrthancDatabases::DatabaseBackendAdapterV2::Register(backend);
   }