# HG changeset patch # User Sebastien Jodogne # Date 1734348712 -3600 # Node ID d4c373c74c0b11822efb7d787b57e05537731544 # Parent 09fe1b384a20c0f2b647ab04b6b57536197a9ee8 recovered build up to 1.9.2 SDK diff -r 09fe1b384a20 -r d4c373c74c0b Framework/Common/StatementId.cpp --- a/Framework/Common/StatementId.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/Framework/Common/StatementId.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -26,6 +26,8 @@ #include #include +#include + namespace OrthancDatabases { bool StatementId::operator< (const StatementId& other) const diff -r 09fe1b384a20 -r d4c373c74c0b Framework/Plugins/IDatabaseBackend.h --- a/Framework/Plugins/IDatabaseBackend.h Mon Dec 16 11:39:00 2024 +0100 +++ b/Framework/Plugins/IDatabaseBackend.h Mon Dec 16 12:31:52 2024 +0100 @@ -398,11 +398,10 @@ virtual void ExecuteCount(Orthanc::DatabasePluginMessages::TransactionResponse& response, DatabaseManager& manager, const Orthanc::DatabasePluginMessages::Find_Request& request) = 0; +#endif virtual bool HasPerformDbHousekeeping() = 0; virtual void PerformDbHousekeeping(DatabaseManager& manager) = 0; - -#endif }; } diff -r 09fe1b384a20 -r d4c373c74c0b Framework/Plugins/ISqlLookupFormatter.cpp --- a/Framework/Plugins/ISqlLookupFormatter.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/Framework/Plugins/ISqlLookupFormatter.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -35,8 +35,9 @@ #include #include +#include +#include #include -#include #include @@ -64,6 +65,7 @@ } +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static std::string FormatLevel(const char* prefix, Orthanc::ResourceType level) { switch (level) @@ -84,6 +86,8 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } } +#endif + static bool FormatComparison(std::string& target, ISqlLookupFormatter& formatter, @@ -261,6 +265,7 @@ } +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static bool FormatComparison(std::string& target, ISqlLookupFormatter& formatter, const Orthanc::DatabasePluginMessages::DatabaseMetadataConstraint& constraint, @@ -313,6 +318,8 @@ escapeBrackets); } +#endif + static bool FormatComparison(std::string& target, ISqlLookupFormatter& formatter, @@ -374,6 +381,8 @@ boost::lexical_cast(constraint.GetTag().GetElement())); } + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static void FormatJoin(std::string& target, const Orthanc::DatabasePluginMessages::DatabaseMetadataConstraint& constraint, Orthanc::ResourceType level, @@ -396,7 +405,10 @@ ".internalId AND " + tag + ".type = " + boost::lexical_cast(constraint.metadata()); } +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static void FormatJoinForOrdering(std::string& target, uint32_t tagGroup, uint32_t tagElement, @@ -450,7 +462,10 @@ " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter; } } +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static void FormatJoinForOrdering(std::string& target, int32_t metadata, size_t index, @@ -462,6 +477,7 @@ ".internalId AND " + arg + ".type = " + boost::lexical_cast(metadata); } +#endif static std::string Join(const std::list& values, @@ -560,8 +576,7 @@ } } - std::string values; - Orthanc::Toolbox::JoinStrings(values, comparisonValues, ", "); + std::string values = boost::algorithm::join(comparisonValues, ", "); if (constraint.IsCaseSensitive()) { @@ -923,8 +938,7 @@ orderByFields.push_back(orderByField); } - std::string orderByFieldsString; - Orthanc::Toolbox::JoinStrings(orderByFieldsString, orderByFields, ", "); + std::string orderByFieldsString = boost::algorithm::join(orderByFields, ", "); if (formatter.SupportsNullsLast()) { diff -r 09fe1b384a20 -r d4c373c74c0b Framework/Plugins/IndexBackend.cpp --- a/Framework/Plugins/IndexBackend.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/Framework/Plugins/IndexBackend.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -36,6 +36,8 @@ #include #include +#include + namespace OrthancDatabases { @@ -60,6 +62,8 @@ return s; } + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) static std::string JoinChanges(const std::set& changeTypes) { std::set changeTypesString; @@ -73,7 +77,9 @@ return joinedChangesTypes; } - +#endif + + template static void ReadListOfIntegers(std::list& target, DatabaseManager::CachedStatement& statement, @@ -663,8 +669,7 @@ std::string filtersString; if (filters.size() > 0) { - Orthanc::Toolbox::JoinStrings(filtersString, filters, " AND "); - filtersString = "WHERE " + filtersString; + filtersString = "WHERE " + boost::algorithm::join(filters, " AND "); } std::string sql; @@ -1361,7 +1366,11 @@ bool IndexBackend::HasMeasureLatency() { +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 2) return true; +#else + return false; +#endif } @@ -3075,6 +3084,7 @@ uint64_t IndexBackend::MeasureLatency(DatabaseManager& manager) { +#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 2) // execute 11x the simplest statement and return the median value std::vector measures; @@ -3092,6 +3102,9 @@ std::sort(measures.begin(), measures.end()); return measures[measures.size() / 2]; +#else + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); +#endif } @@ -4258,17 +4271,5 @@ statement->Next(); } } - - bool IndexBackend::HasPerformDbHousekeeping() - { - return false; - } - - void IndexBackend::PerformDbHousekeeping(DatabaseManager& manager) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); - } - #endif - } diff -r 09fe1b384a20 -r d4c373c74c0b Framework/Plugins/IndexBackend.h --- a/Framework/Plugins/IndexBackend.h Mon Dec 16 11:39:00 2024 +0100 +++ b/Framework/Plugins/IndexBackend.h Mon Dec 16 12:31:52 2024 +0100 @@ -439,7 +439,7 @@ virtual uint64_t MeasureLatency(DatabaseManager& manager) ORTHANC_OVERRIDE; #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) - // New primitive since Orthanc 1.12.5 + // New primitives since Orthanc 1.12.5 virtual bool HasExtendedChanges() const ORTHANC_OVERRIDE { return true; @@ -454,12 +454,17 @@ virtual void ExecuteCount(Orthanc::DatabasePluginMessages::TransactionResponse& response, DatabaseManager& manager, const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; - - virtual bool HasPerformDbHousekeeping() ORTHANC_OVERRIDE; - - virtual void PerformDbHousekeeping(DatabaseManager& manager) ORTHANC_OVERRIDE; #endif + virtual bool HasPerformDbHousekeeping() ORTHANC_OVERRIDE + { + return false; + } + + virtual void PerformDbHousekeeping(DatabaseManager& manager) ORTHANC_OVERRIDE + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } /** * "maxDatabaseRetries" is to handle diff -r 09fe1b384a20 -r d4c373c74c0b MySQL/Plugins/IndexPlugin.cpp --- a/MySQL/Plugins/IndexPlugin.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/MySQL/Plugins/IndexPlugin.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -29,7 +29,9 @@ #include #include -#include +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) +# include +#endif #define ORTHANC_PLUGIN_NAME "mysql-index" @@ -37,7 +39,9 @@ { ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif if (!OrthancDatabases::InitializePlugin(context, ORTHANC_PLUGIN_NAME, "MySQL", true)) { @@ -107,7 +111,10 @@ OrthancDatabases::MySQLDatabase::GlobalFinalization(); Orthanc::HttpClient::GlobalFinalize(); Orthanc::Toolbox::FinalizeOpenSsl(); + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) google::protobuf::ShutdownProtobufLibrary(); +#endif } diff -r 09fe1b384a20 -r d4c373c74c0b Odbc/Plugins/IndexPlugin.cpp --- a/Odbc/Plugins/IndexPlugin.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/Odbc/Plugins/IndexPlugin.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -45,7 +45,9 @@ #endif -#include +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) +# include +#endif static const char* const KEY_ODBC = "Odbc"; @@ -60,7 +62,9 @@ ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif if (!OrthancDatabases::InitializePlugin(context, ORTHANC_PLUGIN_NAME, "ODBC", true)) { @@ -146,7 +150,10 @@ { LOG(WARNING) << "ODBC index is finalizing"; OrthancDatabases::IndexBackend::Finalize(); + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) google::protobuf::ShutdownProtobufLibrary(); +#endif } diff -r 09fe1b384a20 -r d4c373c74c0b PostgreSQL/Plugins/IndexPlugin.cpp --- a/PostgreSQL/Plugins/IndexPlugin.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/PostgreSQL/Plugins/IndexPlugin.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -27,7 +27,9 @@ #include #include -#include +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) +# include +#endif #define ORTHANC_PLUGIN_NAME "postgresql-index" @@ -36,7 +38,9 @@ { ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif if (!OrthancDatabases::InitializePlugin(context, ORTHANC_PLUGIN_NAME, "PostgreSQL", true)) { @@ -102,7 +106,10 @@ LOG(WARNING) << "PostgreSQL index is finalizing"; OrthancDatabases::IndexBackend::Finalize(); Orthanc::Toolbox::FinalizeOpenSsl(); + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) google::protobuf::ShutdownProtobufLibrary(); +#endif } diff -r 09fe1b384a20 -r d4c373c74c0b PostgreSQL/Plugins/PostgreSQLIndex.cpp --- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -36,6 +36,8 @@ #include #include +#include + namespace Orthanc { @@ -638,15 +640,10 @@ revisions.push_back("0"); } - std::string joinedResourceIds; - std::string joinedMetadataTypes; - std::string joinedMetadataValues; - std::string joinedRevisions; - - Orthanc::Toolbox::JoinStrings(joinedResourceIds, resourceIds, ","); - Orthanc::Toolbox::JoinStrings(joinedMetadataTypes, metadataTypes, ","); - Orthanc::Toolbox::JoinStrings(joinedMetadataValues, metadataValues, ","); - Orthanc::Toolbox::JoinStrings(joinedRevisions, revisions, ","); + std::string joinedResourceIds = boost::algorithm::join(resourceIds, ","); + std::string joinedMetadataTypes = boost::algorithm::join(metadataTypes, ","); + std::string joinedMetadataValues = boost::algorithm::join(metadataValues, ","); + std::string joinedRevisions = boost::algorithm::join(revisions, ","); std::string sql = std::string("SELECT InsertOrUpdateMetadata(ARRAY[") + joinedResourceIds + "], ARRAY[" + diff -r 09fe1b384a20 -r d4c373c74c0b SQLite/Plugins/IndexPlugin.cpp --- a/SQLite/Plugins/IndexPlugin.cpp Mon Dec 16 11:39:00 2024 +0100 +++ b/SQLite/Plugins/IndexPlugin.cpp Mon Dec 16 12:31:52 2024 +0100 @@ -26,7 +26,9 @@ #include -#include +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) +# include +#endif #define ORTHANC_PLUGIN_NAME "sqlite-index" @@ -35,7 +37,9 @@ { ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context) { +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif if (!OrthancDatabases::InitializePlugin(context, ORTHANC_PLUGIN_NAME, "SQLite", true)) { @@ -92,7 +96,10 @@ { LOG(WARNING) << "SQLite index is finalizing"; OrthancDatabases::IndexBackend::Finalize(); + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0) google::protobuf::ShutdownProtobufLibrary(); +#endif } diff -r 09fe1b384a20 -r d4c373c74c0b SQLite/Plugins/SQLiteIndex.h --- a/SQLite/Plugins/SQLiteIndex.h Mon Dec 16 11:39:00 2024 +0100 +++ b/SQLite/Plugins/SQLiteIndex.h Mon Dec 16 12:31:52 2024 +0100 @@ -84,11 +84,9 @@ const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; #endif -#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) virtual bool HasChildCountTable() const ORTHANC_OVERRIDE { return false; } -#endif }; }