comparison 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
comparison
equal deleted inserted replaced
371:c1fe28de1bf6 372:b5e2c1e48828
33 #include <Compatibility.h> // For std::unique_ptr<> 33 #include <Compatibility.h> // For std::unique_ptr<>
34 #include <Logging.h> 34 #include <Logging.h>
35 #include <OrthancException.h> 35 #include <OrthancException.h>
36 36
37 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
44
38 namespace OrthancDatabases 45 namespace OrthancDatabases
39 { 46 {
40 static std::string ConvertWildcardToLike(const std::string& query) 47 static std::string ConvertWildcardToLike(const std::string& query)
41 { 48 {
42 std::string s = query; 49 std::string s = query;
2608 if (backend == NULL) 2615 if (backend == NULL)
2609 { 2616 {
2610 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); 2617 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
2611 } 2618 }
2612 2619
2613 bool hasLoadedV3 = false;
2614
2615 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1 2620 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
2616 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2) 2621 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
2617 if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 9, 2) == 1) 2622 if (OrthancPluginCheckVersionAdvanced(backend->GetContext(), 1, 9, 2) == 1)
2618 { 2623 {
2619 LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, " 2624 LOG(WARNING) << "The index plugin will use " << countConnections << " connection(s) to the database, "
2620 << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision"; 2625 << "and will retry up to " << maxDatabaseRetries << " time(s) in the case of a collision";
2621 2626
2622 OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries); 2627 OrthancDatabases::DatabaseBackendAdapterV3::Register(backend, countConnections, maxDatabaseRetries);
2623 hasLoadedV3 = true; 2628 return;
2624 } 2629 }
2625 # endif 2630 # endif
2626 #endif 2631 #endif
2627 2632
2628 if (!hasLoadedV3) 2633 LOG(WARNING) << "Performance warning: Your version of the Orthanc core or SDK doesn't support multiple readers/writers";
2629 { 2634 OrthancDatabases::DatabaseBackendAdapterV2::Register(backend);
2630 LOG(WARNING) << "Performance warning: Your version of the Orthanc core or SDK doesn't support multiple readers/writers";
2631 OrthancDatabases::DatabaseBackendAdapterV2::Register(backend);
2632 }
2633 } 2635 }
2634 2636
2635 2637
2636 bool IndexBackend::LookupGlobalIntegerProperty(int& target, 2638 bool IndexBackend::LookupGlobalIntegerProperty(int& target,
2637 DatabaseManager& manager, 2639 DatabaseManager& manager,