Mercurial > hg > orthanc
comparison OrthancServer/DatabaseWrapper.h @ 2772:f3df536e7366
moving the outdated database plugin sample into the graveyard
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 17 Jul 2018 11:02:18 +0200 |
parents | e583478e0c6c |
children | bb63068844ae |
comparison
equal
deleted
inserted
replaced
2740:e226f3a23f2f | 2772:f3df536e7366 |
---|---|
74 db_.Close(); | 74 db_.Close(); |
75 } | 75 } |
76 | 76 |
77 virtual void SetListener(IDatabaseListener& listener); | 77 virtual void SetListener(IDatabaseListener& listener); |
78 | 78 |
79 virtual void SetGlobalProperty(GlobalProperty property, | |
80 const std::string& value) | |
81 { | |
82 base_.SetGlobalProperty(property, value); | |
83 } | |
84 | |
85 virtual bool LookupGlobalProperty(std::string& target, | |
86 GlobalProperty property) | |
87 { | |
88 return base_.LookupGlobalProperty(target, property); | |
89 } | |
90 | |
91 virtual int64_t CreateResource(const std::string& publicId, | |
92 ResourceType type) | |
93 { | |
94 return base_.CreateResource(publicId, type); | |
95 } | |
96 | |
97 virtual bool LookupResource(int64_t& id, | |
98 ResourceType& type, | |
99 const std::string& publicId) | |
100 { | |
101 return base_.LookupResource(id, type, publicId); | |
102 } | |
103 | |
104 virtual bool LookupParent(int64_t& parentId, | 79 virtual bool LookupParent(int64_t& parentId, |
105 int64_t resourceId); | 80 int64_t resourceId); |
106 | 81 |
107 virtual std::string GetPublicId(int64_t resourceId); | 82 virtual std::string GetPublicId(int64_t resourceId); |
108 | 83 |
109 virtual ResourceType GetResourceType(int64_t resourceId); | 84 virtual ResourceType GetResourceType(int64_t resourceId); |
110 | 85 |
111 virtual void AttachChild(int64_t parent, | |
112 int64_t child) | |
113 { | |
114 base_.AttachChild(parent, child); | |
115 } | |
116 | |
117 virtual void DeleteResource(int64_t id); | 86 virtual void DeleteResource(int64_t id); |
118 | |
119 virtual void SetMetadata(int64_t id, | |
120 MetadataType type, | |
121 const std::string& value) | |
122 { | |
123 base_.SetMetadata(id, type, value); | |
124 } | |
125 | |
126 virtual void DeleteMetadata(int64_t id, | |
127 MetadataType type) | |
128 { | |
129 base_.DeleteMetadata(id, type); | |
130 } | |
131 | |
132 virtual bool LookupMetadata(std::string& target, | |
133 int64_t id, | |
134 MetadataType type) | |
135 { | |
136 return base_.LookupMetadata(target, id, type); | |
137 } | |
138 | |
139 virtual void ListAvailableMetadata(std::list<MetadataType>& target, | |
140 int64_t id) | |
141 { | |
142 base_.ListAvailableMetadata(target, id); | |
143 } | |
144 | |
145 virtual void AddAttachment(int64_t id, | |
146 const FileInfo& attachment) | |
147 { | |
148 base_.AddAttachment(id, attachment); | |
149 } | |
150 | |
151 virtual void DeleteAttachment(int64_t id, | |
152 FileContentType attachment) | |
153 { | |
154 base_.DeleteAttachment(id, attachment); | |
155 } | |
156 | |
157 virtual void ListAvailableAttachments(std::list<FileContentType>& target, | |
158 int64_t id) | |
159 { | |
160 return base_.ListAvailableAttachments(target, id); | |
161 } | |
162 | |
163 virtual bool LookupAttachment(FileInfo& attachment, | |
164 int64_t id, | |
165 FileContentType contentType) | |
166 { | |
167 return base_.LookupAttachment(attachment, id, contentType); | |
168 } | |
169 | |
170 virtual void ClearMainDicomTags(int64_t id) | |
171 { | |
172 base_.ClearMainDicomTags(id); | |
173 } | |
174 | |
175 virtual void SetMainDicomTag(int64_t id, | |
176 const DicomTag& tag, | |
177 const std::string& value) | |
178 { | |
179 base_.SetMainDicomTag(id, tag, value); | |
180 } | |
181 | |
182 virtual void SetIdentifierTag(int64_t id, | |
183 const DicomTag& tag, | |
184 const std::string& value) | |
185 { | |
186 base_.SetIdentifierTag(id, tag, value); | |
187 } | |
188 | |
189 virtual void GetMainDicomTags(DicomMap& map, | |
190 int64_t id) | |
191 { | |
192 base_.GetMainDicomTags(map, id); | |
193 } | |
194 | |
195 virtual void GetChildrenPublicId(std::list<std::string>& target, | |
196 int64_t id) | |
197 { | |
198 base_.GetChildrenPublicId(target, id); | |
199 } | |
200 | |
201 virtual void GetChildrenInternalId(std::list<int64_t>& target, | |
202 int64_t id) | |
203 { | |
204 base_.GetChildrenInternalId(target, id); | |
205 } | |
206 | |
207 virtual void LogChange(int64_t internalId, | |
208 const ServerIndexChange& change) | |
209 { | |
210 base_.LogChange(internalId, change); | |
211 } | |
212 | 87 |
213 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, | 88 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
214 bool& done /*out*/, | 89 bool& done /*out*/, |
215 int64_t since, | 90 int64_t since, |
216 uint32_t maxResults); | 91 uint32_t maxResults); |
217 | 92 |
218 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/); | 93 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/); |
94 | |
95 virtual SQLite::ITransaction* StartTransaction() | |
96 { | |
97 return new SQLite::Transaction(db_); | |
98 } | |
99 | |
100 virtual void FlushToDisk() | |
101 { | |
102 db_.FlushToDisk(); | |
103 } | |
104 | |
105 virtual bool HasFlushToDisk() const | |
106 { | |
107 return true; | |
108 } | |
109 | |
110 virtual void ClearChanges() | |
111 { | |
112 ClearTable("Changes"); | |
113 } | |
114 | |
115 virtual void ClearExportedResources() | |
116 { | |
117 ClearTable("ExportedResources"); | |
118 } | |
119 | |
120 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, | |
121 int64_t id); | |
122 | |
123 virtual unsigned int GetDatabaseVersion() | |
124 { | |
125 return version_; | |
126 } | |
127 | |
128 virtual void Upgrade(unsigned int targetVersion, | |
129 IStorageArea& storageArea); | |
130 | |
131 | |
132 /** | |
133 * The methods declared below are for unit testing only! | |
134 **/ | |
135 | |
136 const char* GetErrorMessage() const | |
137 { | |
138 return db_.GetErrorMessage(); | |
139 } | |
140 | |
141 void GetChildren(std::list<std::string>& childrenPublicIds, | |
142 int64_t id); | |
143 | |
144 int64_t GetTableRecordCount(const std::string& table); | |
145 | |
146 bool GetParentPublicId(std::string& target, | |
147 int64_t id); | |
148 | |
149 | |
150 | |
151 /** | |
152 * Until Orthanc 1.4.0, the methods below were part of the | |
153 * "DatabaseWrapperBase" class, that is now placed in the | |
154 * graveyard. | |
155 **/ | |
156 | |
157 virtual void SetGlobalProperty(GlobalProperty property, | |
158 const std::string& value) | |
159 { | |
160 base_.SetGlobalProperty(property, value); | |
161 } | |
162 | |
163 virtual bool LookupGlobalProperty(std::string& target, | |
164 GlobalProperty property) | |
165 { | |
166 return base_.LookupGlobalProperty(target, property); | |
167 } | |
168 | |
169 virtual int64_t CreateResource(const std::string& publicId, | |
170 ResourceType type) | |
171 { | |
172 return base_.CreateResource(publicId, type); | |
173 } | |
174 | |
175 virtual bool LookupResource(int64_t& id, | |
176 ResourceType& type, | |
177 const std::string& publicId) | |
178 { | |
179 return base_.LookupResource(id, type, publicId); | |
180 } | |
181 | |
182 virtual void AttachChild(int64_t parent, | |
183 int64_t child) | |
184 { | |
185 base_.AttachChild(parent, child); | |
186 } | |
187 | |
188 virtual void SetMetadata(int64_t id, | |
189 MetadataType type, | |
190 const std::string& value) | |
191 { | |
192 base_.SetMetadata(id, type, value); | |
193 } | |
194 | |
195 virtual void DeleteMetadata(int64_t id, | |
196 MetadataType type) | |
197 { | |
198 base_.DeleteMetadata(id, type); | |
199 } | |
200 | |
201 virtual bool LookupMetadata(std::string& target, | |
202 int64_t id, | |
203 MetadataType type) | |
204 { | |
205 return base_.LookupMetadata(target, id, type); | |
206 } | |
207 | |
208 virtual void ListAvailableMetadata(std::list<MetadataType>& target, | |
209 int64_t id) | |
210 { | |
211 base_.ListAvailableMetadata(target, id); | |
212 } | |
213 | |
214 virtual void AddAttachment(int64_t id, | |
215 const FileInfo& attachment) | |
216 { | |
217 base_.AddAttachment(id, attachment); | |
218 } | |
219 | |
220 virtual void DeleteAttachment(int64_t id, | |
221 FileContentType attachment) | |
222 { | |
223 base_.DeleteAttachment(id, attachment); | |
224 } | |
225 | |
226 virtual void ListAvailableAttachments(std::list<FileContentType>& target, | |
227 int64_t id) | |
228 { | |
229 return base_.ListAvailableAttachments(target, id); | |
230 } | |
231 | |
232 virtual bool LookupAttachment(FileInfo& attachment, | |
233 int64_t id, | |
234 FileContentType contentType) | |
235 { | |
236 return base_.LookupAttachment(attachment, id, contentType); | |
237 } | |
238 | |
239 virtual void ClearMainDicomTags(int64_t id) | |
240 { | |
241 base_.ClearMainDicomTags(id); | |
242 } | |
243 | |
244 virtual void SetMainDicomTag(int64_t id, | |
245 const DicomTag& tag, | |
246 const std::string& value) | |
247 { | |
248 base_.SetMainDicomTag(id, tag, value); | |
249 } | |
250 | |
251 virtual void SetIdentifierTag(int64_t id, | |
252 const DicomTag& tag, | |
253 const std::string& value) | |
254 { | |
255 base_.SetIdentifierTag(id, tag, value); | |
256 } | |
257 | |
258 virtual void GetMainDicomTags(DicomMap& map, | |
259 int64_t id) | |
260 { | |
261 base_.GetMainDicomTags(map, id); | |
262 } | |
263 | |
264 virtual void GetChildrenPublicId(std::list<std::string>& target, | |
265 int64_t id) | |
266 { | |
267 base_.GetChildrenPublicId(target, id); | |
268 } | |
269 | |
270 virtual void GetChildrenInternalId(std::list<int64_t>& target, | |
271 int64_t id) | |
272 { | |
273 base_.GetChildrenInternalId(target, id); | |
274 } | |
275 | |
276 virtual void LogChange(int64_t internalId, | |
277 const ServerIndexChange& change) | |
278 { | |
279 base_.LogChange(internalId, change); | |
280 } | |
219 | 281 |
220 virtual void LogExportedResource(const ExportedResource& resource) | 282 virtual void LogExportedResource(const ExportedResource& resource) |
221 { | 283 { |
222 base_.LogExportedResource(resource); | 284 base_.LogExportedResource(resource); |
223 } | 285 } |
290 bool isProtected) | 352 bool isProtected) |
291 { | 353 { |
292 base_.SetProtectedPatient(internalId, isProtected); | 354 base_.SetProtectedPatient(internalId, isProtected); |
293 } | 355 } |
294 | 356 |
295 virtual SQLite::ITransaction* StartTransaction() | |
296 { | |
297 return new SQLite::Transaction(db_); | |
298 } | |
299 | |
300 virtual void FlushToDisk() | |
301 { | |
302 db_.FlushToDisk(); | |
303 } | |
304 | |
305 virtual bool HasFlushToDisk() const | |
306 { | |
307 return true; | |
308 } | |
309 | |
310 virtual void ClearChanges() | |
311 { | |
312 ClearTable("Changes"); | |
313 } | |
314 | |
315 virtual void ClearExportedResources() | |
316 { | |
317 ClearTable("ExportedResources"); | |
318 } | |
319 | |
320 virtual bool IsExistingResource(int64_t internalId) | 357 virtual bool IsExistingResource(int64_t internalId) |
321 { | 358 { |
322 return base_.IsExistingResource(internalId); | 359 return base_.IsExistingResource(internalId); |
323 } | 360 } |
324 | 361 |
340 { | 377 { |
341 base_.LookupIdentifierRange(result, level, tag, start, end); | 378 base_.LookupIdentifierRange(result, level, tag, start, end); |
342 } | 379 } |
343 | 380 |
344 | 381 |
345 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, | |
346 int64_t id); | |
347 | |
348 virtual unsigned int GetDatabaseVersion() | |
349 { | |
350 return version_; | |
351 } | |
352 | |
353 virtual void Upgrade(unsigned int targetVersion, | |
354 IStorageArea& storageArea); | |
355 | |
356 | |
357 | |
358 /** | |
359 * The methods declared below are for unit testing only! | |
360 **/ | |
361 | |
362 const char* GetErrorMessage() const | |
363 { | |
364 return db_.GetErrorMessage(); | |
365 } | |
366 | |
367 void GetChildren(std::list<std::string>& childrenPublicIds, | |
368 int64_t id); | |
369 | |
370 int64_t GetTableRecordCount(const std::string& table); | |
371 | |
372 bool GetParentPublicId(std::string& target, | |
373 int64_t id); | |
374 | |
375 }; | 382 }; |
376 } | 383 } |