Mercurial > hg > orthanc-databases
annotate PostgreSQL/Plugins/PostgreSQLStorageArea.h @ 19:38e23471d132
more visibility on the index creation
author | am@osimis.io |
---|---|
date | Tue, 10 Jul 2018 11:05:37 +0200 |
parents | 9774802fd05f |
children | 9e419261f1c9 |
rev | line source |
---|---|
14
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #pragma once |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "../../Framework/Plugins/StorageBackend.h" |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../../Framework/PostgreSQL/PostgreSQLParameters.h" |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace OrthancDatabases |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 class PostgreSQLStorageArea : public StorageBackend |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 private: |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 class Factory : public IDatabaseFactory |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 private: |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 PostgreSQLStorageArea& that_; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 public: |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 Factory(PostgreSQLStorageArea& that) : |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 that_(that) |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 } |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 virtual Dialect GetDialect() const |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 return Dialect_PostgreSQL; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 } |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 virtual IDatabase* Open() |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 return that_.OpenInternal(); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 } |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 }; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 OrthancPluginContext* context_; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 PostgreSQLParameters parameters_; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 bool clearAll_; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 IDatabase* OpenInternal(); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 public: |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 PostgreSQLStorageArea(const PostgreSQLParameters& parameters); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 void SetClearAll(bool clear) |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 { |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 clearAll_ = clear; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 } |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 virtual void Create(DatabaseManager::Transaction& transaction, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 const std::string& uuid, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 const void* content, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 size_t size, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 OrthancPluginContentType type); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 virtual void Read(void*& content, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 size_t& size, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 DatabaseManager::Transaction& transaction, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 const std::string& uuid, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 OrthancPluginContentType type); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 virtual void Remove(DatabaseManager::Transaction& transaction, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 const std::string& uuid, |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 OrthancPluginContentType type); |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 }; |
9774802fd05f
PostgreSQLStorageArea working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 } |