changeset 381:9cde77ca9ad9 db-protobuf

initializing and finalizing protobuf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Mar 2023 21:16:57 +0200
parents cb91096fef06
children 97f12bcd1826
files Framework/Plugins/IndexBackend.cpp MySQL/Plugins/IndexPlugin.cpp PostgreSQL/Plugins/IndexPlugin.cpp SQLite/Plugins/IndexPlugin.cpp
diffstat 4 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.cpp	Thu Mar 30 17:08:00 2023 +0200
+++ b/Framework/Plugins/IndexBackend.cpp	Thu Mar 30 21:16:57 2023 +0200
@@ -2692,6 +2692,12 @@
     OrthancDatabases::DatabaseBackendAdapterV3::Finalize();
 #  endif
 #endif
+
+#if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)         // Macro introduced in Orthanc 1.3.1
+#  if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
+    OrthancDatabases::DatabaseBackendAdapterV4::Finalize();
+#  endif
+#endif
   }
 
 
--- a/MySQL/Plugins/IndexPlugin.cpp	Thu Mar 30 17:08:00 2023 +0200
+++ b/MySQL/Plugins/IndexPlugin.cpp	Thu Mar 30 21:16:57 2023 +0200
@@ -28,11 +28,15 @@
 #include <Logging.h>
 #include <Toolbox.h>
 
+#include <google/protobuf/any.h>
+
 
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
   {
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+
     if (!OrthancDatabases::InitializePlugin(context, "MySQL", true))
     {
       return -1;
@@ -93,6 +97,7 @@
     OrthancDatabases::MySQLDatabase::GlobalFinalization();
     Orthanc::HttpClient::GlobalFinalize();
     Orthanc::Toolbox::FinalizeOpenSsl();
+    google::protobuf::ShutdownProtobufLibrary();
   }
 
 
--- a/PostgreSQL/Plugins/IndexPlugin.cpp	Thu Mar 30 17:08:00 2023 +0200
+++ b/PostgreSQL/Plugins/IndexPlugin.cpp	Thu Mar 30 21:16:57 2023 +0200
@@ -26,11 +26,15 @@
 #include <Logging.h>
 #include <Toolbox.h>
 
+#include <google/protobuf/any.h>
+
 
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
   {
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+
     if (!OrthancDatabases::InitializePlugin(context, "PostgreSQL", true))
     {
       return -1;
@@ -87,6 +91,7 @@
     LOG(WARNING) << "PostgreSQL index is finalizing";
     OrthancDatabases::IndexBackend::Finalize();
     Orthanc::Toolbox::FinalizeOpenSsl();
+    google::protobuf::ShutdownProtobufLibrary();
   }
 
 
--- a/SQLite/Plugins/IndexPlugin.cpp	Thu Mar 30 17:08:00 2023 +0200
+++ b/SQLite/Plugins/IndexPlugin.cpp	Thu Mar 30 21:16:57 2023 +0200
@@ -25,11 +25,15 @@
 
 #include <Logging.h>
 
+#include <google/protobuf/any.h>
+
 
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
   {
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+
     if (!OrthancDatabases::InitializePlugin(context, "SQLite", true))
     {
       return -1;
@@ -84,6 +88,7 @@
   {
     LOG(WARNING) << "SQLite index is finalizing";
     OrthancDatabases::IndexBackend::Finalize();
+    google::protobuf::ShutdownProtobufLibrary();
   }