Mercurial > hg > orthanc-databases
diff PostgreSQL/Plugins/PostgreSQLStorageArea.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 | dd6cfc250747 |
children | b97a537f4613 |
line wrap: on
line diff
--- a/PostgreSQL/Plugins/PostgreSQLStorageArea.h Thu Apr 01 19:18:19 2021 +0200 +++ b/PostgreSQL/Plugins/PostgreSQLStorageArea.h Fri Apr 02 19:23:36 2021 +0200 @@ -22,53 +22,19 @@ #pragma once #include "../../Framework/Plugins/StorageBackend.h" -#include "../../Framework/PostgreSQL/PostgreSQLParameters.h" +#include "../../Framework/PostgreSQL/PostgreSQLDatabase.h" namespace OrthancDatabases { class PostgreSQLStorageArea : public StorageBackend { private: - class Factory : public IDatabaseFactory - { - private: - PostgreSQLStorageArea& that_; - - public: - explicit Factory(PostgreSQLStorageArea& that) : - that_(that) - { - } - - virtual Dialect GetDialect() const ORTHANC_OVERRIDE - { - return Dialect_PostgreSQL; - } - - 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(); - } - }; - - PostgreSQLParameters parameters_; - bool clearAll_; - - IDatabase* OpenInternal(); + void ConfigureDatabase(PostgreSQLDatabase& db, + const PostgreSQLParameters& parameters, + bool clearAll); public: - explicit PostgreSQLStorageArea(const PostgreSQLParameters& parameters); - - void SetClearAll(bool clear) - { - clearAll_ = clear; - } + PostgreSQLStorageArea(const PostgreSQLParameters& parameters, + bool clearAll); }; }