Mercurial > hg > orthanc-databases
comparison PostgreSQL/Plugins/PostgreSQLStorageArea.h @ 14:9774802fd05f
PostgreSQLStorageArea working
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Jul 2018 20:28:27 +0200 |
parents | |
children | 9e419261f1c9 |
comparison
equal
deleted
inserted
replaced
13:927264a0c137 | 14:9774802fd05f |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium | |
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/PostgreSQL/PostgreSQLParameters.h" | |
26 | |
27 namespace OrthancDatabases | |
28 { | |
29 class PostgreSQLStorageArea : public StorageBackend | |
30 { | |
31 private: | |
32 class Factory : public IDatabaseFactory | |
33 { | |
34 private: | |
35 PostgreSQLStorageArea& that_; | |
36 | |
37 public: | |
38 Factory(PostgreSQLStorageArea& that) : | |
39 that_(that) | |
40 { | |
41 } | |
42 | |
43 virtual Dialect GetDialect() const | |
44 { | |
45 return Dialect_PostgreSQL; | |
46 } | |
47 | |
48 virtual IDatabase* Open() | |
49 { | |
50 return that_.OpenInternal(); | |
51 } | |
52 }; | |
53 | |
54 OrthancPluginContext* context_; | |
55 PostgreSQLParameters parameters_; | |
56 bool clearAll_; | |
57 | |
58 IDatabase* OpenInternal(); | |
59 | |
60 public: | |
61 PostgreSQLStorageArea(const PostgreSQLParameters& parameters); | |
62 | |
63 void SetClearAll(bool clear) | |
64 { | |
65 clearAll_ = clear; | |
66 } | |
67 | |
68 virtual void Create(DatabaseManager::Transaction& transaction, | |
69 const std::string& uuid, | |
70 const void* content, | |
71 size_t size, | |
72 OrthancPluginContentType type); | |
73 | |
74 virtual void Read(void*& content, | |
75 size_t& size, | |
76 DatabaseManager::Transaction& transaction, | |
77 const std::string& uuid, | |
78 OrthancPluginContentType type); | |
79 | |
80 virtual void Remove(DatabaseManager::Transaction& transaction, | |
81 const std::string& uuid, | |
82 OrthancPluginContentType type); | |
83 }; | |
84 } |