Mercurial > hg > orthanc
comparison OrthancServer/DatabaseWrapper.cpp @ 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 |
comparison
equal
deleted
inserted
replaced
1670:16955f8fec4d | 1671:2f2e2ec17bc4 |
---|---|
384 { | 384 { |
385 db_.Execute("DELETE FROM " + tableName); | 385 db_.Execute("DELETE FROM " + tableName); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 bool DatabaseWrapper::LookupParent(int64_t& parentId, | |
390 int64_t resourceId) | |
391 { | |
392 bool found; | |
393 ErrorCode error = base_.LookupParent(found, parentId, resourceId); | |
394 | |
395 if (error != ErrorCode_Success) | |
396 { | |
397 throw OrthancException(error); | |
398 } | |
399 else | |
400 { | |
401 return found; | |
402 } | |
403 } | |
404 | |
405 | |
406 ResourceType DatabaseWrapper::GetResourceType(int64_t resourceId) | |
407 { | |
408 ResourceType result; | |
409 ErrorCode code = base_.GetResourceType(result, resourceId); | |
410 | |
411 if (code == ErrorCode_Success) | |
412 { | |
413 return result; | |
414 } | |
415 else | |
416 { | |
417 throw OrthancException(code); | |
418 } | |
419 } | |
420 | |
421 | |
422 std::string DatabaseWrapper::GetPublicId(int64_t resourceId) | |
423 { | |
424 std::string id; | |
425 | |
426 if (base_.GetPublicId(id, resourceId)) | |
427 { | |
428 return id; | |
429 } | |
430 else | |
431 { | |
432 throw OrthancException(ErrorCode_UnknownResource); | |
433 } | |
434 } | |
435 | |
436 | |
437 void DatabaseWrapper::GetChanges(std::list<ServerIndexChange>& target /*out*/, | |
438 bool& done /*out*/, | |
439 int64_t since, | |
440 uint32_t maxResults) | |
441 { | |
442 ErrorCode code = base_.GetChanges(target, done, since, maxResults); | |
443 | |
444 if (code != ErrorCode_Success) | |
445 { | |
446 throw OrthancException(code); | |
447 } | |
448 } | |
449 | |
450 | |
451 void DatabaseWrapper::GetLastChange(std::list<ServerIndexChange>& target /*out*/) | |
452 { | |
453 ErrorCode code = base_.GetLastChange(target); | |
454 | |
455 if (code != ErrorCode_Success) | |
456 { | |
457 throw OrthancException(code); | |
458 } | |
459 } | |
460 | |
461 | |
462 void DatabaseWrapper::LookupIdentifier(std::list<int64_t>& target, | |
463 const DicomTag& tag, | |
464 const std::string& value) | |
465 { | |
466 if (!tag.IsIdentifier()) | |
467 { | |
468 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
469 } | |
470 | |
471 base_.LookupIdentifier(target, tag, value); | |
472 } | |
473 | |
474 | |
389 void DatabaseWrapper::GetAllMetadata(std::map<MetadataType, std::string>& target, | 475 void DatabaseWrapper::GetAllMetadata(std::map<MetadataType, std::string>& target, |
390 int64_t id) | 476 int64_t id) |
391 { | 477 { |
392 target.clear(); | 478 target.clear(); |
393 | 479 |