comparison 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
comparison
equal deleted inserted replaced
372:b5e2c1e48828 373:be7de633695c
26 #include "../Common/BinaryStringValue.h" 26 #include "../Common/BinaryStringValue.h"
27 #include "../Common/Integer64Value.h" 27 #include "../Common/Integer64Value.h"
28 #include "../Common/Utf8StringValue.h" 28 #include "../Common/Utf8StringValue.h"
29 #include "DatabaseBackendAdapterV2.h" 29 #include "DatabaseBackendAdapterV2.h"
30 #include "DatabaseBackendAdapterV3.h" 30 #include "DatabaseBackendAdapterV3.h"
31 #include "DatabaseBackendAdapterV4.h"
31 #include "GlobalProperties.h" 32 #include "GlobalProperties.h"
32 33
33 #include <Compatibility.h> // For std::unique_ptr<> 34 #include <Compatibility.h> // For std::unique_ptr<>
34 #include <Logging.h> 35 #include <Logging.h>
35 #include <OrthancException.h> 36 #include <OrthancException.h>
36
37
38 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
39 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
40 # include "OrthancDatabasePlugin.pb.h" // Include protobuf messages
41 # endif
42 #endif
43 37
44 38
45 namespace OrthancDatabases 39 namespace OrthancDatabases
46 { 40 {
47 static std::string ConvertWildcardToLike(const std::string& query) 41 static std::string ConvertWildcardToLike(const std::string& query)
2615 if (backend == NULL) 2609 if (backend == NULL)
2616 { 2610 {
2617 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); 2611 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
2618 } 2612 }
2619 2613
2614 LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, "
2615 << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
2616
2617 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
2618 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
2619 if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 12, 0) == 1)
2620 {
2621 OrthancDatabases::DatabaseBackendAdapterV4::Register(backend, countConnections, maxDatabaseRetries);
2622 return;
2623 }
2624 # endif
2625 #endif
2626
2620 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1 2627 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
2621 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2) 2628 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
2622 if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 9, 2) == 1) 2629 if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 9, 2) == 1)
2623 { 2630 {
2624 LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, "
2625 << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
2626
2627 OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries); 2631 OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries);
2628 return; 2632 return;
2629 } 2633 }
2630 # endif 2634 # endif
2631 #endif 2635 #endif