Mercurial > hg > orthanc-databases
annotate MySQL/Plugins/MySQLStorageArea.h @ 185:7c46155b5bb4
fix mingw build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Dec 2020 13:59:17 +0100 |
parents | 0b3e9ee53c46 |
children | 6fe74f9a516e |
rev | line source |
---|---|
17 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
140
4cd7e45b671e
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
17 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../../Framework/Plugins/StorageBackend.h" | |
25 #include "../../Framework/MySQL/MySQLParameters.h" | |
26 | |
27 | |
28 namespace OrthancDatabases | |
29 { | |
30 class MySQLStorageArea : public StorageBackend | |
31 { | |
32 private: | |
33 class Factory : public IDatabaseFactory | |
34 { | |
35 private: | |
36 MySQLStorageArea& that_; | |
37 | |
38 public: | |
39 Factory(MySQLStorageArea& that) : | |
40 that_(that) | |
41 { | |
42 } | |
43 | |
44 virtual Dialect GetDialect() const | |
45 { | |
46 return Dialect_MySQL; | |
47 } | |
48 | |
49 virtual IDatabase* Open() | |
50 { | |
51 return that_.OpenInternal(); | |
52 } | |
141
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
53 |
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
54 virtual void GetConnectionRetriesParameters(unsigned int& maxConnectionRetries, unsigned int& connectionRetryInterval) |
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
55 { |
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
56 maxConnectionRetries = that_.parameters_.GetMaxConnectionRetries(); |
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
57 connectionRetryInterval = that_.parameters_.GetConnectionRetryInterval(); |
0b3e9ee53c46
Added 'MaximumConnectionRetries' & 'ConnectionRetryInterval' to configure the retries when connecting to the DB at startup
Alain Mazy <alain@mazy.be>
parents:
140
diff
changeset
|
58 } |
17 | 59 }; |
60 | |
61 OrthancPluginContext* context_; | |
62 MySQLParameters parameters_; | |
63 bool clearAll_; | |
64 | |
65 IDatabase* OpenInternal(); | |
66 | |
67 public: | |
68 MySQLStorageArea(const MySQLParameters& parameters); | |
69 | |
70 void SetClearAll(bool clear) | |
71 { | |
72 clearAll_ = clear; | |
73 } | |
74 }; | |
75 } |