changeset 605:09fe1b384a20 find-refactoring

fix SQLite build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Dec 2024 11:39:00 +0100
parents ce2a754600ef
children d4c373c74c0b
files Framework/Plugins/IndexBackend.h Framework/Plugins/IndexConnectionsPool.cpp SQLite/Plugins/IndexPlugin.cpp SQLite/Plugins/SQLiteIndex.cpp SQLite/Plugins/SQLiteIndex.h
diffstat 5 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Plugins/IndexBackend.h	Mon Dec 16 11:25:15 2024 +0100
+++ b/Framework/Plugins/IndexBackend.h	Mon Dec 16 11:39:00 2024 +0100
@@ -83,7 +83,8 @@
                                        uint32_t limit);
 
   public:
-    explicit IndexBackend(OrthancPluginContext* context, bool readOnly);
+    explicit IndexBackend(OrthancPluginContext* context,
+                          bool readOnly);
 
     virtual OrthancPluginContext* GetContext() ORTHANC_OVERRIDE
     {
@@ -457,7 +458,6 @@
     virtual bool HasPerformDbHousekeeping() ORTHANC_OVERRIDE;
 
     virtual void PerformDbHousekeeping(DatabaseManager& manager) ORTHANC_OVERRIDE;
-
 #endif
 
 
--- a/Framework/Plugins/IndexConnectionsPool.cpp	Mon Dec 16 11:25:15 2024 +0100
+++ b/Framework/Plugins/IndexConnectionsPool.cpp	Mon Dec 16 11:39:00 2024 +0100
@@ -95,6 +95,12 @@
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
+    else if (backend->HasPerformDbHousekeeping() &&
+             houseKeepingDelaySeconds == 0)
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange,
+                                      "The delay between two executions of housekeeping cannot be zero second");
+    }
     else
     {
       context_ = backend_->GetContext();
--- a/SQLite/Plugins/IndexPlugin.cpp	Mon Dec 16 11:25:15 2024 +0100
+++ b/SQLite/Plugins/IndexPlugin.cpp	Mon Dec 16 11:39:00 2024 +0100
@@ -70,7 +70,8 @@
       OrthancDatabases::IndexBackend::Register(
         new OrthancDatabases::SQLiteIndex(context, "index.db"),   // TODO parameter
         1 /* only 1 connection is possible with SQLite */,
-        0 /* no collision is possible, as SQLite has a global lock */);
+        0 /* no collision is possible, as SQLite has a global lock */,
+        0 /* housekeeping delay, unused for SQLite */);
     }
     catch (Orthanc::OrthancException& e)
     {
--- a/SQLite/Plugins/SQLiteIndex.cpp	Mon Dec 16 11:25:15 2024 +0100
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Mon Dec 16 11:39:00 2024 +0100
@@ -191,7 +191,7 @@
 
   SQLiteIndex::SQLiteIndex(OrthancPluginContext* context,
                            const std::string& path) :
-    IndexBackend(context),
+    IndexBackend(context, false /* not read-only */),
     path_(path),
     fast_(true)
   {
@@ -203,7 +203,7 @@
 
 
   SQLiteIndex::SQLiteIndex(OrthancPluginContext* context) :
-    IndexBackend(context),
+    IndexBackend(context, false /* not read-only */),
     fast_(true)
   {
   }
--- a/SQLite/Plugins/SQLiteIndex.h	Mon Dec 16 11:25:15 2024 +0100
+++ b/SQLite/Plugins/SQLiteIndex.h	Mon Dec 16 11:39:00 2024 +0100
@@ -76,10 +76,19 @@
     virtual void ExecuteFind(Orthanc::DatabasePluginMessages::TransactionResponse& response,
                              DatabaseManager& manager,
                              const Orthanc::DatabasePluginMessages::Find_Request& request) ORTHANC_OVERRIDE;
+#endif
 
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 5)
     virtual void ExecuteCount(Orthanc::DatabasePluginMessages::TransactionResponse& response,
                               DatabaseManager& manager,
                               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
   };
 }