diff Framework/Plugins/IndexBackend.cpp @ 373:be7de633695c db-protobuf

started DatabaseBackendAdapterV4
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Mar 2023 12:47:54 +0200
parents b5e2c1e48828
children 9db9e0275ec0
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Tue Mar 28 11:40:07 2023 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Tue Mar 28 12:47:54 2023 +0200
@@ -28,6 +28,7 @@
 #include "../Common/Utf8StringValue.h"
 #include "DatabaseBackendAdapterV2.h"
 #include "DatabaseBackendAdapterV3.h"
+#include "DatabaseBackendAdapterV4.h"
 #include "GlobalProperties.h"
 
 #include <Compatibility.h>  // For std::unique_ptr<>
@@ -35,13 +36,6 @@
 #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)
@@ -2617,13 +2611,23 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
     
+    LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, "
+                 << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
+      
+#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)         // Macro introduced in Orthanc 1.3.1
+#  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
+    if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 12, 0) == 1)
+    {
+      OrthancDatabases::DatabaseBackendAdapterV4::Register(backend, countConnections, maxDatabaseRetries);
+      return;
+    }
+#  endif
+#endif
+
 #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)
     {
-      LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, "
-                   << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
-      
       OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries);
       return;
     }