annotate OrthancServer/DatabaseWrapper.h @ 1671:2f2e2ec17bc4 db-changes

sample database plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 01 Oct 2015 17:44:43 +0200
parents 16955f8fec4d
children 4c5a85c3ff43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1286
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1286
diff changeset
4 * Department, University Hospital of Liege, Belgium
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
35 #include "IDatabaseWrapper.h"
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
36
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../Core/SQLite/Connection.h"
187
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
38 #include "../Core/SQLite/Transaction.h"
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
39 #include "DatabaseWrapperBase.h"
1242
58e6a89c3ef4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1241
diff changeset
40
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace Internals
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 class SignalRemainingAncestor;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 }
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 /**
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * This class manages an instance of the Orthanc SQLite database. It
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * translates low-level requests into SQL statements. Mutual
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * exclusion MUST be implemented at a higher level.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 **/
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
53 class DatabaseWrapper : public IDatabaseWrapper
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 private:
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1306
diff changeset
56 IDatabaseListener* listener_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 SQLite::Connection db_;
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
58 DatabaseWrapperBase base_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 Internals::SignalRemainingAncestor* signalRemainingAncestor_;
1615
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
60 unsigned int version_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 void Open();
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
64 void ClearTable(const std::string& tableName);
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
65
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 public:
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
67 DatabaseWrapper(const std::string& path);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
68
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
69 DatabaseWrapper();
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
70
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1306
diff changeset
71 virtual void SetListener(IDatabaseListener& listener);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
73 virtual void SetGlobalProperty(GlobalProperty property,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
74 const std::string& value)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
75 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
76 base_.SetGlobalProperty(property, value);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
77 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
79 virtual bool LookupGlobalProperty(std::string& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
80 GlobalProperty property)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
81 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
82 return base_.LookupGlobalProperty(target, property);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
83 }
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
84
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
85 virtual int64_t CreateResource(const std::string& publicId,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
86 ResourceType type)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
87 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
88 return base_.CreateResource(publicId, type);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
89 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
1294
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
91 virtual bool LookupResource(int64_t& id,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
92 ResourceType& type,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
93 const std::string& publicId)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
94 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
95 return base_.LookupResource(id, type, publicId);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
96 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
98 virtual bool LookupParent(int64_t& parentId,
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
99 int64_t resourceId);
198
663cc6c46d0a before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 197
diff changeset
100
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
101 virtual std::string GetPublicId(int64_t resourceId);
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
102
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
103 virtual ResourceType GetResourceType(int64_t resourceId);
198
663cc6c46d0a before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 197
diff changeset
104
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
105 virtual void AttachChild(int64_t parent,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
106 int64_t child)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
107 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
108 base_.AttachChild(parent, child);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
109 }
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
110
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
111 virtual void DeleteResource(int64_t id);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
113 virtual void SetMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
114 MetadataType type,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
115 const std::string& value)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
116 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
117 base_.SetMetadata(id, type, value);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
118 }
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
119
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
120 virtual void DeleteMetadata(int64_t id,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
121 MetadataType type)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
122 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
123 base_.DeleteMetadata(id, type);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
124 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
126 virtual bool LookupMetadata(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
127 int64_t id,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
128 MetadataType type)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
129 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
130 return base_.LookupMetadata(target, id, type);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
131 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
133 virtual void ListAvailableMetadata(std::list<MetadataType>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
134 int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
135 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
136 base_.ListAvailableMetadata(target, id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
137 }
438
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
138
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
139 virtual void AddAttachment(int64_t id,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
140 const FileInfo& attachment)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
141 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
142 base_.AddAttachment(id, attachment);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
143 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
145 virtual void DeleteAttachment(int64_t id,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
146 FileContentType attachment)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
147 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
148 base_.DeleteAttachment(id, attachment);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
149 }
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
150
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
151 virtual void ListAvailableAttachments(std::list<FileContentType>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
152 int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
153 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
154 return base_.ListAvailableAttachments(target, id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
155 }
436
d51186bf7602 read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
156
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
157 virtual bool LookupAttachment(FileInfo& attachment,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
158 int64_t id,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
159 FileContentType contentType)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
160 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
161 return base_.LookupAttachment(attachment, id, contentType);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
162 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
164 virtual void ClearMainDicomTags(int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
165 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
166 base_.ClearMainDicomTags(id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
167 }
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1664
diff changeset
168
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
169 virtual void SetMainDicomTag(int64_t id,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
170 const DicomTag& tag,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
171 const std::string& value)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
172 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
173 base_.SetMainDicomTag(id, tag, value);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
174 }
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
175
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
176 virtual void GetMainDicomTags(DicomMap& map,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
177 int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
178 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
179 base_.GetMainDicomTags(map, id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
180 }
440
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
181
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
182 virtual void GetChildrenPublicId(std::list<std::string>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
183 int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
184 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
185 base_.GetChildrenPublicId(target, id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
186 }
200
9c58b2b03cf0 refactoring of read operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 199
diff changeset
187
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
188 virtual void GetChildrenInternalId(std::list<int64_t>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
189 int64_t id)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
190 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
191 base_.GetChildrenInternalId(target, id);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
192 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
194 virtual void LogChange(int64_t internalId,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
195 const ServerIndexChange& change)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
196 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
197 base_.LogChange(internalId, change);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
198 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
200 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
201 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
202 int64_t since,
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
203 uint32_t maxResults);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
205 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/);
204
7f4acf490179 changes api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 202
diff changeset
206
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
207 virtual void LogExportedResource(const ExportedResource& resource)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
208 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
209 base_.LogExportedResource(resource);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
210 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
212 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
213 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
214 int64_t since,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
215 uint32_t maxResults)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
216 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
217 base_.GetExportedResources(target, done, since, maxResults);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
218 }
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
219
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
220 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
221 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
222 base_.GetLastExportedResource(target);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
223 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
225 virtual uint64_t GetTotalCompressedSize()
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
226 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
227 return base_.GetTotalCompressedSize();
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
228 }
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
229
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
230 virtual uint64_t GetTotalUncompressedSize()
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
231 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
232 return base_.GetTotalUncompressedSize();
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
233 }
238
e4148b0ab1d0 statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 237
diff changeset
234
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
235 virtual uint64_t GetResourceCount(ResourceType resourceType)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
236 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
237 return base_.GetResourceCount(resourceType);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
238 }
190
b6cef9d45cc3 getallpublicids
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 189
diff changeset
239
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
240 virtual void GetAllPublicIds(std::list<std::string>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
241 ResourceType resourceType)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
242 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
243 base_.GetAllPublicIds(target, resourceType);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
244 }
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
245
1509
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
246 virtual void GetAllPublicIds(std::list<std::string>& target,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
247 ResourceType resourceType,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
248 size_t since,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
249 size_t limit)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
250 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
251 base_.GetAllPublicIds(target, resourceType, since, limit);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
252 }
1509
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
253
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
254 virtual bool SelectPatientToRecycle(int64_t& internalId)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
255 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
256 return base_.SelectPatientToRecycle(internalId);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
257 }
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
258
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
259 virtual bool SelectPatientToRecycle(int64_t& internalId,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
260 int64_t patientIdToAvoid)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
261 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
262 return base_.SelectPatientToRecycle(internalId, patientIdToAvoid);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
263 }
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
264
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
265 virtual bool IsProtectedPatient(int64_t internalId)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
266 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
267 return base_.IsProtectedPatient(internalId);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
268 }
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
269
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
270 virtual void SetProtectedPatient(int64_t internalId,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
271 bool isProtected)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
272 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
273 base_.SetProtectedPatient(internalId, isProtected);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
274 }
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
276 virtual SQLite::ITransaction* StartTransaction()
187
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
277 {
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
278 return new SQLite::Transaction(db_);
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
279 }
202
1650557bd81a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 200
diff changeset
280
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
281 virtual void FlushToDisk()
206
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
282 {
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
283 db_.FlushToDisk();
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
284 }
310
6ab6cdeedf4e global sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
285
1306
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
286 virtual bool HasFlushToDisk() const
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
287 {
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
288 return true;
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
289 }
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
290
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
291 virtual void ClearChanges()
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
292 {
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
293 ClearTable("Changes");
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
294 }
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
295
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
296 virtual void ClearExportedResources()
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
297 {
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
298 ClearTable("ExportedResources");
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
299 }
513
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
300
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
301 virtual bool IsExistingResource(int64_t internalId)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
302 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
303 return base_.IsExistingResource(internalId);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
304 }
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 513
diff changeset
305
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
306 virtual void LookupIdentifier(std::list<int64_t>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
307 const DicomTag& tag,
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1670
diff changeset
308 const std::string& value);
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 513
diff changeset
309
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
310 virtual void LookupIdentifier(std::list<int64_t>& target,
1670
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
311 const std::string& value)
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
312 {
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
313 base_.LookupIdentifier(target, value);
16955f8fec4d refactoring: DatabaseWrapperBase
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
314 }
1006
649d47854314 proper handling of metadata in Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 742
diff changeset
315
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
316 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
317 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
318
1615
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
319 virtual unsigned int GetDatabaseVersion()
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
320 {
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
321 return version_;
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
322 }
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
323
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
324 virtual void Upgrade(unsigned int targetVersion,
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
325 IStorageArea& storageArea);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
326
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
327
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
328
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
329 /**
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
330 * The methods declared below are for unit testing only!
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
331 **/
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
332
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
333 const char* GetErrorMessage() const
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
334 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
335 return db_.GetErrorMessage();
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
336 }
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
337
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
338 void GetChildren(std::list<std::string>& childrenPublicIds,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
339 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
340
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
341 int64_t GetTableRecordCount(const std::string& table);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
342
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
343 bool GetParentPublicId(std::string& target,
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
344 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
345
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 };
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 }