comparison OrthancServer/DatabaseWrapper.h @ 2773:bb63068844ae

moving DatabaseWrapperBase into graveyard
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Jul 2018 11:25:54 +0200
parents f3df536e7366
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2772:f3df536e7366 2773:bb63068844ae
35 35
36 #include "IDatabaseWrapper.h" 36 #include "IDatabaseWrapper.h"
37 37
38 #include "../Core/SQLite/Connection.h" 38 #include "../Core/SQLite/Connection.h"
39 #include "../Core/SQLite/Transaction.h" 39 #include "../Core/SQLite/Transaction.h"
40 #include "DatabaseWrapperBase.h"
41 40
42 namespace Orthanc 41 namespace Orthanc
43 { 42 {
44 namespace Internals 43 namespace Internals
45 { 44 {
54 class DatabaseWrapper : public IDatabaseWrapper 53 class DatabaseWrapper : public IDatabaseWrapper
55 { 54 {
56 private: 55 private:
57 IDatabaseListener* listener_; 56 IDatabaseListener* listener_;
58 SQLite::Connection db_; 57 SQLite::Connection db_;
59 DatabaseWrapperBase base_;
60 Internals::SignalRemainingAncestor* signalRemainingAncestor_; 58 Internals::SignalRemainingAncestor* signalRemainingAncestor_;
61 unsigned int version_; 59 unsigned int version_;
60
61 void GetChangesInternal(std::list<ServerIndexChange>& target,
62 bool& done,
63 SQLite::Statement& s,
64 uint32_t maxResults);
65
66 void GetExportedResourcesInternal(std::list<ExportedResource>& target,
67 bool& done,
68 SQLite::Statement& s,
69 uint32_t maxResults);
62 70
63 void ClearTable(const std::string& tableName); 71 void ClearTable(const std::string& tableName);
64 72
65 public: 73 public:
66 DatabaseWrapper(const std::string& path); 74 DatabaseWrapper(const std::string& path);
153 * "DatabaseWrapperBase" class, that is now placed in the 161 * "DatabaseWrapperBase" class, that is now placed in the
154 * graveyard. 162 * graveyard.
155 **/ 163 **/
156 164
157 virtual void SetGlobalProperty(GlobalProperty property, 165 virtual void SetGlobalProperty(GlobalProperty property,
158 const std::string& value) 166 const std::string& value);
159 {
160 base_.SetGlobalProperty(property, value);
161 }
162 167
163 virtual bool LookupGlobalProperty(std::string& target, 168 virtual bool LookupGlobalProperty(std::string& target,
164 GlobalProperty property) 169 GlobalProperty property);
165 {
166 return base_.LookupGlobalProperty(target, property);
167 }
168 170
169 virtual int64_t CreateResource(const std::string& publicId, 171 virtual int64_t CreateResource(const std::string& publicId,
170 ResourceType type) 172 ResourceType type);
171 {
172 return base_.CreateResource(publicId, type);
173 }
174 173
175 virtual bool LookupResource(int64_t& id, 174 virtual bool LookupResource(int64_t& id,
176 ResourceType& type, 175 ResourceType& type,
177 const std::string& publicId) 176 const std::string& publicId);
178 {
179 return base_.LookupResource(id, type, publicId);
180 }
181 177
182 virtual void AttachChild(int64_t parent, 178 virtual void AttachChild(int64_t parent,
183 int64_t child) 179 int64_t child);
184 {
185 base_.AttachChild(parent, child);
186 }
187 180
188 virtual void SetMetadata(int64_t id, 181 virtual void SetMetadata(int64_t id,
189 MetadataType type, 182 MetadataType type,
190 const std::string& value) 183 const std::string& value);
191 {
192 base_.SetMetadata(id, type, value);
193 }
194 184
195 virtual void DeleteMetadata(int64_t id, 185 virtual void DeleteMetadata(int64_t id,
196 MetadataType type) 186 MetadataType type);
197 {
198 base_.DeleteMetadata(id, type);
199 }
200 187
201 virtual bool LookupMetadata(std::string& target, 188 virtual bool LookupMetadata(std::string& target,
202 int64_t id, 189 int64_t id,
203 MetadataType type) 190 MetadataType type);
204 {
205 return base_.LookupMetadata(target, id, type);
206 }
207 191
208 virtual void ListAvailableMetadata(std::list<MetadataType>& target, 192 virtual void ListAvailableMetadata(std::list<MetadataType>& target,
209 int64_t id) 193 int64_t id);
210 {
211 base_.ListAvailableMetadata(target, id);
212 }
213 194
214 virtual void AddAttachment(int64_t id, 195 virtual void AddAttachment(int64_t id,
215 const FileInfo& attachment) 196 const FileInfo& attachment);
216 {
217 base_.AddAttachment(id, attachment);
218 }
219 197
220 virtual void DeleteAttachment(int64_t id, 198 virtual void DeleteAttachment(int64_t id,
221 FileContentType attachment) 199 FileContentType attachment);
222 {
223 base_.DeleteAttachment(id, attachment);
224 }
225 200
226 virtual void ListAvailableAttachments(std::list<FileContentType>& target, 201 virtual void ListAvailableAttachments(std::list<FileContentType>& target,
227 int64_t id) 202 int64_t id);
228 {
229 return base_.ListAvailableAttachments(target, id);
230 }
231 203
232 virtual bool LookupAttachment(FileInfo& attachment, 204 virtual bool LookupAttachment(FileInfo& attachment,
233 int64_t id, 205 int64_t id,
234 FileContentType contentType) 206 FileContentType contentType);
235 { 207
236 return base_.LookupAttachment(attachment, id, contentType); 208 virtual void ClearMainDicomTags(int64_t id);
237 }
238
239 virtual void ClearMainDicomTags(int64_t id)
240 {
241 base_.ClearMainDicomTags(id);
242 }
243 209
244 virtual void SetMainDicomTag(int64_t id, 210 virtual void SetMainDicomTag(int64_t id,
245 const DicomTag& tag, 211 const DicomTag& tag,
246 const std::string& value) 212 const std::string& value);
247 {
248 base_.SetMainDicomTag(id, tag, value);
249 }
250 213
251 virtual void SetIdentifierTag(int64_t id, 214 virtual void SetIdentifierTag(int64_t id,
252 const DicomTag& tag, 215 const DicomTag& tag,
253 const std::string& value) 216 const std::string& value);
254 {
255 base_.SetIdentifierTag(id, tag, value);
256 }
257 217
258 virtual void GetMainDicomTags(DicomMap& map, 218 virtual void GetMainDicomTags(DicomMap& map,
259 int64_t id) 219 int64_t id);
260 {
261 base_.GetMainDicomTags(map, id);
262 }
263 220
264 virtual void GetChildrenPublicId(std::list<std::string>& target, 221 virtual void GetChildrenPublicId(std::list<std::string>& target,
265 int64_t id) 222 int64_t id);
266 {
267 base_.GetChildrenPublicId(target, id);
268 }
269 223
270 virtual void GetChildrenInternalId(std::list<int64_t>& target, 224 virtual void GetChildrenInternalId(std::list<int64_t>& target,
271 int64_t id) 225 int64_t id);
272 {
273 base_.GetChildrenInternalId(target, id);
274 }
275 226
276 virtual void LogChange(int64_t internalId, 227 virtual void LogChange(int64_t internalId,
277 const ServerIndexChange& change) 228 const ServerIndexChange& change);
278 { 229
279 base_.LogChange(internalId, change); 230 virtual void LogExportedResource(const ExportedResource& resource);
280 }
281
282 virtual void LogExportedResource(const ExportedResource& resource)
283 {
284 base_.LogExportedResource(resource);
285 }
286 231
287 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, 232 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
288 bool& done /*out*/, 233 bool& done /*out*/,
289 int64_t since, 234 int64_t since,
290 uint32_t maxResults) 235 uint32_t maxResults);
291 { 236
292 base_.GetExportedResources(target, done, since, maxResults); 237 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/);
293 } 238
294 239 virtual uint64_t GetTotalCompressedSize();
295 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
296 {
297 base_.GetLastExportedResource(target);
298 }
299
300 virtual uint64_t GetTotalCompressedSize()
301 {
302 return base_.GetTotalCompressedSize();
303 }
304 240
305 virtual uint64_t GetTotalUncompressedSize() 241 virtual uint64_t GetTotalUncompressedSize();
306 { 242
307 return base_.GetTotalUncompressedSize(); 243 virtual uint64_t GetResourceCount(ResourceType resourceType);
308 }
309
310 virtual uint64_t GetResourceCount(ResourceType resourceType)
311 {
312 return base_.GetResourceCount(resourceType);
313 }
314 244
315 virtual void GetAllInternalIds(std::list<int64_t>& target, 245 virtual void GetAllInternalIds(std::list<int64_t>& target,
316 ResourceType resourceType) 246 ResourceType resourceType);
317 {
318 base_.GetAllInternalIds(target, resourceType);
319 }
320 247
321 virtual void GetAllPublicIds(std::list<std::string>& target, 248 virtual void GetAllPublicIds(std::list<std::string>& target,
322 ResourceType resourceType) 249 ResourceType resourceType);
323 {
324 base_.GetAllPublicIds(target, resourceType);
325 }
326 250
327 virtual void GetAllPublicIds(std::list<std::string>& target, 251 virtual void GetAllPublicIds(std::list<std::string>& target,
328 ResourceType resourceType, 252 ResourceType resourceType,
329 size_t since, 253 size_t since,
330 size_t limit) 254 size_t limit);
331 { 255
332 base_.GetAllPublicIds(target, resourceType, since, limit); 256 virtual bool SelectPatientToRecycle(int64_t& internalId);
333 }
334
335 virtual bool SelectPatientToRecycle(int64_t& internalId)
336 {
337 return base_.SelectPatientToRecycle(internalId);
338 }
339 257
340 virtual bool SelectPatientToRecycle(int64_t& internalId, 258 virtual bool SelectPatientToRecycle(int64_t& internalId,
341 int64_t patientIdToAvoid) 259 int64_t patientIdToAvoid);
342 { 260
343 return base_.SelectPatientToRecycle(internalId, patientIdToAvoid); 261 virtual bool IsProtectedPatient(int64_t internalId);
344 }
345
346 virtual bool IsProtectedPatient(int64_t internalId)
347 {
348 return base_.IsProtectedPatient(internalId);
349 }
350 262
351 virtual void SetProtectedPatient(int64_t internalId, 263 virtual void SetProtectedPatient(int64_t internalId,
352 bool isProtected) 264 bool isProtected);
353 { 265
354 base_.SetProtectedPatient(internalId, isProtected); 266 virtual bool IsExistingResource(int64_t internalId);
355 }
356
357 virtual bool IsExistingResource(int64_t internalId)
358 {
359 return base_.IsExistingResource(internalId);
360 }
361 267
362 virtual void LookupIdentifier(std::list<int64_t>& result, 268 virtual void LookupIdentifier(std::list<int64_t>& result,
363 ResourceType level, 269 ResourceType level,
364 const DicomTag& tag, 270 const DicomTag& tag,
365 IdentifierConstraintType type, 271 IdentifierConstraintType type,
366 const std::string& value) 272 const std::string& value);
367 {
368 base_.LookupIdentifier(result, level, tag, type, value);
369 }
370
371 273
372 virtual void LookupIdentifierRange(std::list<int64_t>& result, 274 virtual void LookupIdentifierRange(std::list<int64_t>& result,
373 ResourceType level, 275 ResourceType level,
374 const DicomTag& tag, 276 const DicomTag& tag,
375 const std::string& start, 277 const std::string& start,
376 const std::string& end) 278 const std::string& end);
377 {
378 base_.LookupIdentifierRange(result, level, tag, start, end);
379 }
380
381
382 }; 279 };
383 } 280 }