annotate OrthancServer/DatabaseWrapper.h @ 1348:cff17da28916

ArchiveStudiesInTimeRange.py sample
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Apr 2015 15:12:04 +0200
parents 8cd5784a6d80
children 0ac74fa21db8
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"
1242
58e6a89c3ef4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1241
diff changeset
39
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 namespace Internals
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 class SignalRemainingAncestor;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
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 * This class manages an instance of the Orthanc SQLite database. It
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 * translates low-level requests into SQL statements. Mutual
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * exclusion MUST be implemented at a higher level.
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 **/
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
52 class DatabaseWrapper : public IDatabaseWrapper
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 private:
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
55 IServerIndexListener* listener_;
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 SQLite::Connection db_;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 Internals::SignalRemainingAncestor* signalRemainingAncestor_;
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 void Open();
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
1240
62c35e4b67db refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1239
diff changeset
61 void GetChangesInternal(std::list<ServerIndexChange>& target,
62c35e4b67db refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1239
diff changeset
62 bool& done,
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
63 SQLite::Statement& s,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
64 uint32_t maxResults);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
65
1244
a0e420c5f2b8 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1242
diff changeset
66 void GetExportedResourcesInternal(std::list<ExportedResource>& target,
a0e420c5f2b8 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1242
diff changeset
67 bool& done,
742
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
68 SQLite::Statement& s,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
69 uint32_t maxResults);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
70
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
71 void ClearTable(const std::string& tableName);
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
72
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 public:
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
74 DatabaseWrapper(const std::string& path);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
75
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
76 DatabaseWrapper();
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
77
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
78 virtual void SetListener(IServerIndexListener& listener);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
80 virtual void SetGlobalProperty(GlobalProperty property,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
81 const std::string& value);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
83 virtual bool LookupGlobalProperty(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
84 GlobalProperty property);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
85
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
86 virtual int64_t CreateResource(const std::string& publicId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
87 ResourceType type);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
1294
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
89 virtual bool LookupResource(int64_t& id,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
90 ResourceType& type,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
91 const std::string& publicId);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
93 virtual bool LookupParent(int64_t& parentId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
94 int64_t resourceId);
198
663cc6c46d0a before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 197
diff changeset
95
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
96 virtual std::string GetPublicId(int64_t resourceId);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
97
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
98 virtual ResourceType GetResourceType(int64_t resourceId);
198
663cc6c46d0a before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 197
diff changeset
99
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
100 virtual void AttachChild(int64_t parent,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
101 int64_t child);
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 268
diff changeset
102
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
103 virtual void DeleteResource(int64_t id);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
105 virtual void SetMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
106 MetadataType type,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
107 const std::string& value);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
108
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
109 virtual void DeleteMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
110 MetadataType type);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
112 virtual bool LookupMetadata(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
113 int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
114 MetadataType type);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
116 virtual void ListAvailableMetadata(std::list<MetadataType>& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
117 int64_t id);
438
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
118
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
119 virtual void AddAttachment(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
120 const FileInfo& attachment);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
122 virtual void DeleteAttachment(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
123 FileContentType attachment);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
124
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
125 virtual void ListAvailableAttachments(std::list<FileContentType>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
126 int64_t id);
436
d51186bf7602 read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 413
diff changeset
127
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
128 virtual bool LookupAttachment(FileInfo& attachment,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
129 int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
130 FileContentType contentType);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
132 virtual void SetMainDicomTag(int64_t id,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
133 const DicomTag& tag,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
134 const std::string& value);
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
135
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
136 virtual void GetMainDicomTags(DicomMap& map,
440
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
137 int64_t id);
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
138
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
139 virtual void GetChildrenPublicId(std::list<std::string>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
140 int64_t id);
200
9c58b2b03cf0 refactoring of read operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 199
diff changeset
141
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
142 virtual void GetChildrenInternalId(std::list<int64_t>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
143 int64_t id);
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 LogChange(int64_t internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
146 const ServerIndexChange& change);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
148 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
149 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
150 int64_t since,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
151 uint32_t maxResults);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
153 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/);
204
7f4acf490179 changes api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 202
diff changeset
154
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
155 virtual void LogExportedResource(const ExportedResource& resource);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
157 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
158 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
159 int64_t since,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
160 uint32_t maxResults);
237
16a4ac70bd8a last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 233
diff changeset
161
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
162 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
164 virtual uint64_t GetTotalCompressedSize();
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
165
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
166 virtual uint64_t GetTotalUncompressedSize();
238
e4148b0ab1d0 statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 237
diff changeset
167
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
168 virtual uint64_t GetResourceCount(ResourceType resourceType);
190
b6cef9d45cc3 getallpublicids
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 189
diff changeset
169
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
170 virtual void GetAllPublicIds(std::list<std::string>& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
171 ResourceType resourceType);
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
172
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
173 virtual bool SelectPatientToRecycle(int64_t& internalId);
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
174
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
175 virtual bool SelectPatientToRecycle(int64_t& internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
176 int64_t patientIdToAvoid);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
177
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
178 virtual bool IsProtectedPatient(int64_t internalId);
262
2354560daf2f primitives for recycling patients
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 238
diff changeset
179
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
180 virtual void SetProtectedPatient(int64_t internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
181 bool isProtected);
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
183 virtual SQLite::ITransaction* StartTransaction()
187
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
184 {
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
185 return new SQLite::Transaction(db_);
8e673a65564d refactoring of storing new instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
186 }
202
1650557bd81a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 200
diff changeset
187
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
188 virtual void FlushToDisk()
206
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
189 {
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
190 db_.FlushToDisk();
4453a010d0db flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 204
diff changeset
191 }
310
6ab6cdeedf4e global sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
192
1306
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
193 virtual bool HasFlushToDisk() const
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
194 {
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
195 return true;
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
196 }
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
197
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
198 virtual void ClearChanges()
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
199 {
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
200 ClearTable("Changes");
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
201 }
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
202
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
203 virtual void ClearExportedResources()
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
204 {
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
205 ClearTable("ExportedResources");
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
206 }
513
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 440
diff changeset
207
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
208 virtual bool IsExistingResource(int64_t internalId);
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 513
diff changeset
209
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
210 virtual void LookupIdentifier(std::list<int64_t>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
211 const DicomTag& tag,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
212 const std::string& value);
521
2c739f76d0bb lookup tag values
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 513
diff changeset
213
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
214 virtual void LookupIdentifier(std::list<int64_t>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
215 const std::string& value);
1006
649d47854314 proper handling of metadata in Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 742
diff changeset
216
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
217 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
218 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
219
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
220
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
221
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
222
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
223 /**
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
224 * The methods declared below are for unit testing only!
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
225 **/
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
226
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
227 const char* GetErrorMessage() const
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
228 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
229 return db_.GetErrorMessage();
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
230 }
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1246
diff changeset
231
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
232 void GetChildren(std::list<std::string>& childrenPublicIds,
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
233 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
234
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
235 int64_t GetTableRecordCount(const std::string& table);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
236
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
237 bool GetParentPublicId(std::string& target,
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
238 int64_t id);
1241
90d2f320862d refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1240
diff changeset
239
183
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 };
baada606da3c databasewrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 }