Mercurial > hg > orthanc-databases
comparison 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 |
comparison
equal
deleted
inserted
replaced
225:94c9908e6aca | 226:a4918d57435c |
---|---|
20 | 20 |
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "../../Framework/Plugins/StorageBackend.h" | 24 #include "../../Framework/Plugins/StorageBackend.h" |
25 #include "../../Framework/MySQL/MySQLParameters.h" | 25 #include "../../Framework/MySQL/MySQLDatabase.h" |
26 | 26 |
27 | 27 |
28 namespace OrthancDatabases | 28 namespace OrthancDatabases |
29 { | 29 { |
30 class MySQLStorageArea : public StorageBackend | 30 class MySQLStorageArea : public StorageBackend |
31 { | 31 { |
32 private: | 32 private: |
33 class Factory : public IDatabaseFactory | 33 void ConfigureDatabase(MySQLDatabase& db, |
34 { | 34 const MySQLParameters& parameters, |
35 private: | 35 bool clearAll); |
36 MySQLStorageArea& that_; | 36 |
37 | |
38 public: | |
39 explicit Factory(MySQLStorageArea& that) : | |
40 that_(that) | |
41 { | |
42 } | |
43 | |
44 virtual Dialect GetDialect() const ORTHANC_OVERRIDE | |
45 { | |
46 return Dialect_MySQL; | |
47 } | |
48 | |
49 virtual IDatabase* Open() ORTHANC_OVERRIDE | |
50 { | |
51 return that_.OpenInternal(); | |
52 } | |
53 | |
54 virtual void GetConnectionRetriesParameters(unsigned int& maxConnectionRetries, | |
55 unsigned int& connectionRetryInterval) ORTHANC_OVERRIDE | |
56 { | |
57 maxConnectionRetries = that_.parameters_.GetMaxConnectionRetries(); | |
58 connectionRetryInterval = that_.parameters_.GetConnectionRetryInterval(); | |
59 } | |
60 }; | |
61 | |
62 MySQLParameters parameters_; | |
63 bool clearAll_; | |
64 | |
65 IDatabase* OpenInternal(); | |
66 | |
67 public: | 37 public: |
68 explicit MySQLStorageArea(const MySQLParameters& parameters); | 38 MySQLStorageArea(const MySQLParameters& parameters, |
69 | 39 bool clearAll); |
70 void SetClearAll(bool clear) | |
71 { | |
72 clearAll_ = clear; | |
73 } | |
74 }; | 40 }; |
75 } | 41 } |