diff MySQL/Plugins/MySQLStorageArea.h @ 226:a4918d57435c

DatabaseManager doesn't IDatabaseFactory anymore
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Apr 2021 19:23:36 +0200
parents 3236894320d6
children b97a537f4613
line wrap: on
line diff
--- a/MySQL/Plugins/MySQLStorageArea.h	Thu Apr 01 19:18:19 2021 +0200
+++ b/MySQL/Plugins/MySQLStorageArea.h	Fri Apr 02 19:23:36 2021 +0200
@@ -22,7 +22,7 @@
 #pragma once
 
 #include "../../Framework/Plugins/StorageBackend.h"
-#include "../../Framework/MySQL/MySQLParameters.h"
+#include "../../Framework/MySQL/MySQLDatabase.h"
 
 
 namespace OrthancDatabases
@@ -30,46 +30,12 @@
   class MySQLStorageArea : public StorageBackend
   {
   private:
-    class Factory : public IDatabaseFactory
-    {
-    private:
-      MySQLStorageArea&  that_;
-
-    public:
-      explicit Factory(MySQLStorageArea& that) :
-        that_(that)
-      {
-      }
-
-      virtual Dialect GetDialect() const ORTHANC_OVERRIDE
-      {
-        return Dialect_MySQL;
-      }
-
-      virtual IDatabase* Open() ORTHANC_OVERRIDE
-      {
-        return that_.OpenInternal();
-      }
-
-      virtual void GetConnectionRetriesParameters(unsigned int& maxConnectionRetries,
-                                                  unsigned int& connectionRetryInterval) ORTHANC_OVERRIDE
-      {
-        maxConnectionRetries = that_.parameters_.GetMaxConnectionRetries();
-        connectionRetryInterval = that_.parameters_.GetConnectionRetryInterval();
-      }
-    };
-
-    MySQLParameters        parameters_;
-    bool                   clearAll_;
-
-    IDatabase* OpenInternal();
-
+    void ConfigureDatabase(MySQLDatabase& db,
+                           const MySQLParameters& parameters,
+                           bool clearAll);
+    
   public:
-    explicit MySQLStorageArea(const MySQLParameters& parameters);
-
-    void SetClearAll(bool clear)
-    {
-      clearAll_ = clear;
-    }
+    MySQLStorageArea(const MySQLParameters& parameters,
+                     bool clearAll);
   };
 }