Mercurial > hg > orthanc-databases
annotate MySQL/Plugins/MySQLIndex.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 | 3236894320d6 |
rev | line source |
---|---|
0 | 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:
111
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 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/IndexBackend.h" | |
25 #include "../../Framework/MySQL/MySQLParameters.h" | |
26 | |
27 namespace OrthancDatabases | |
28 { | |
29 class MySQLIndex : public IndexBackend | |
30 { | |
31 private: | |
32 class Factory : public IDatabaseFactory | |
33 { | |
34 private: | |
35 MySQLIndex& that_; | |
36 | |
37 public: | |
38 Factory(MySQLIndex& that) : | |
39 that_(that) | |
40 { | |
41 } | |
42 | |
43 virtual Dialect GetDialect() const | |
44 { | |
45 return Dialect_MySQL; | |
46 } | |
47 | |
48 virtual IDatabase* Open() | |
49 { | |
50 return that_.OpenInternal(); | |
51 } | |
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
|
52 |
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 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
|
54 { |
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 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
|
56 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
|
57 } |
0 | 58 }; |
59 | |
60 OrthancPluginContext* context_; | |
61 MySQLParameters parameters_; | |
62 bool clearAll_; | |
63 | |
64 IDatabase* OpenInternal(); | |
65 | |
66 public: | |
67 MySQLIndex(const MySQLParameters& parameters); | |
68 | |
69 void SetOrthancPluginContext(OrthancPluginContext* context) | |
70 { | |
71 context_ = context; | |
72 } | |
73 | |
74 void SetClearAll(bool clear) | |
75 { | |
76 clearAll_ = clear; | |
77 } | |
78 | |
79 virtual int64_t CreateResource(const char* publicId, | |
111 | 80 OrthancPluginResourceType type) |
81 ORTHANC_OVERRIDE; | |
0 | 82 |
111 | 83 virtual void DeleteResource(int64_t id) ORTHANC_OVERRIDE; |
87
48d445f756db
new extension implemented for MySQL: GetLastChangeIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
84 |
111 | 85 virtual int64_t GetLastChangeIndex() ORTHANC_OVERRIDE; |
110
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
86 |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
87 virtual bool HasCreateInstance() const ORTHANC_OVERRIDE |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
88 { |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
89 return true; |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
90 } |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
91 |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
92 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
93 virtual void CreateInstance(OrthancPluginCreateInstanceResult& result, |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
94 const char* hashPatient, |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
95 const char* hashStudy, |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
96 const char* hashSeries, |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
97 const char* hashInstance) |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
98 ORTHANC_OVERRIDE; |
441a472bfd93
new extension implemented for MySQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
99 #endif |
0 | 100 }; |
101 } |