# HG changeset patch # User Sebastien Jodogne # Date 1721390367 -7200 # Node ID 4511251226923ef367f94a24708771ee9076fa8e # Parent 586b80ea397ce394407bcb694fb3314e01240e7d created branch find-refactoring diff -r 586b80ea397c -r 451125122692 Framework/Plugins/DatabaseBackendAdapterV4.cpp --- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp Thu Jun 06 14:43:38 2024 +0200 +++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp Fri Jul 19 13:59:27 2024 +0200 @@ -439,6 +439,10 @@ response.mutable_get_system_information()->set_has_measure_latency(accessor.GetBackend().HasMeasureLatency()); #endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + response.mutable_get_system_information()->set_supports_find(accessor.GetBackend().HasFindSupport()); +#endif + break; } @@ -1298,6 +1302,12 @@ break; } + case Orthanc::DatabasePluginMessages::OPERATION_FIND: + { + backend.ExecuteFind(response, manager, request.find()); + break; + } + default: LOG(ERROR) << "Not implemented transaction operation from protobuf: " << request.operation(); throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); diff -r 586b80ea397c -r 451125122692 Framework/Plugins/IDatabaseBackend.h --- a/Framework/Plugins/IDatabaseBackend.h Thu Jun 06 14:43:38 2024 +0200 +++ b/Framework/Plugins/IDatabaseBackend.h Fri Jul 19 13:59:27 2024 +0200 @@ -32,6 +32,14 @@ #include +#include + +#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1 +# if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) +# include // Include protobuf messages for "Find()" +# endif +#endif + namespace OrthancDatabases { class IDatabaseBackend : public boost::noncopyable @@ -377,6 +385,15 @@ // New in Orthanc 1.12.3 virtual uint64_t MeasureLatency(DatabaseManager& manager) = 0; +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual bool HasFindSupport() const = 0; +#endif +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + // New in Orthanc 1.12.5 + virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) = 0; +#endif }; } diff -r 586b80ea397c -r 451125122692 MySQL/Plugins/MySQLIndex.cpp --- a/MySQL/Plugins/MySQLIndex.cpp Thu Jun 06 14:43:38 2024 +0200 +++ b/MySQL/Plugins/MySQLIndex.cpp Fri Jul 19 13:59:27 2024 +0200 @@ -593,4 +593,24 @@ } } #endif + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + bool MySQLIndex::HasFindSupport() const + { + // TODO-FIND + return false; + } +#endif + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + void MySQLIndex::ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) + { + // TODO-FIND + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } +#endif } diff -r 586b80ea397c -r 451125122692 MySQL/Plugins/MySQLIndex.h --- a/MySQL/Plugins/MySQLIndex.h Thu Jun 06 14:43:38 2024 +0200 +++ b/MySQL/Plugins/MySQLIndex.h Fri Jul 19 13:59:27 2024 +0200 @@ -85,5 +85,15 @@ { return true; } + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual bool HasFindSupport() const ORTHANC_OVERRIDE; +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; +#endif }; } diff -r 586b80ea397c -r 451125122692 Odbc/Plugins/OdbcIndex.cpp --- a/Odbc/Plugins/OdbcIndex.cpp Thu Jun 06 14:43:38 2024 +0200 +++ b/Odbc/Plugins/OdbcIndex.cpp Fri Jul 19 13:59:27 2024 +0200 @@ -695,4 +695,24 @@ SignalDeletedFiles(output, manager); } + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + bool OdbcIndex::HasFindSupport() const + { + // TODO-FIND + return false; + } +#endif + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + void OdbcIndex::ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) + { + // TODO-FIND + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } +#endif } diff -r 586b80ea397c -r 451125122692 Odbc/Plugins/OdbcIndex.h --- a/Odbc/Plugins/OdbcIndex.h Thu Jun 06 14:43:38 2024 +0200 +++ b/Odbc/Plugins/OdbcIndex.h Fri Jul 19 13:59:27 2024 +0200 @@ -92,5 +92,15 @@ { return false; } + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual bool HasFindSupport() const ORTHANC_OVERRIDE; +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; +#endif }; } diff -r 586b80ea397c -r 451125122692 PostgreSQL/Plugins/PostgreSQLIndex.cpp --- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp Thu Jun 06 14:43:38 2024 +0200 +++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp Fri Jul 19 13:59:27 2024 +0200 @@ -659,4 +659,24 @@ // backward compatibility is necessary throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); } + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + bool PostgreSQLIndex::HasFindSupport() const + { + // TODO-FIND + return false; + } +#endif + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + void PostgreSQLIndex::ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) + { + // TODO-FIND + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } +#endif } diff -r 586b80ea397c -r 451125122692 PostgreSQL/Plugins/PostgreSQLIndex.h --- a/PostgreSQL/Plugins/PostgreSQLIndex.h Thu Jun 06 14:43:38 2024 +0200 +++ b/PostgreSQL/Plugins/PostgreSQLIndex.h Fri Jul 19 13:59:27 2024 +0200 @@ -135,5 +135,14 @@ int64_t& compressedSize, int64_t& uncompressedSize) ORTHANC_OVERRIDE; +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual bool HasFindSupport() const ORTHANC_OVERRIDE; +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; +#endif }; } diff -r 586b80ea397c -r 451125122692 SQLite/Plugins/SQLiteIndex.cpp --- a/SQLite/Plugins/SQLiteIndex.cpp Thu Jun 06 14:43:38 2024 +0200 +++ b/SQLite/Plugins/SQLiteIndex.cpp Fri Jul 19 13:59:27 2024 +0200 @@ -259,4 +259,24 @@ } } } + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + bool SQLiteIndex::HasFindSupport() const + { + // TODO-FIND + return false; + } +#endif + + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + void SQLiteIndex::ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) + { + // TODO-FIND + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); + } +#endif } diff -r 586b80ea397c -r 451125122692 SQLite/Plugins/SQLiteIndex.h --- a/SQLite/Plugins/SQLiteIndex.h Thu Jun 06 14:43:38 2024 +0200 +++ b/SQLite/Plugins/SQLiteIndex.h Fri Jul 19 13:59:27 2024 +0200 @@ -67,5 +67,15 @@ { return true; } + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual bool HasFindSupport() const ORTHANC_OVERRIDE; +#endif + +#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5) + virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response, + DatabaseManager& manager, + const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE; +#endif }; }