# HG changeset patch # User Sebastien Jodogne # Date 1618392051 -7200 # Node ID ed12248ad791a4fb2276af35c83eeffca7e4bbe9 # Parent 29ac6f4a0f45e9594bc9ada016df587f71960f95 implementation of minor api improvements in OrthancCDatabasePlugin.h diff -r 29ac6f4a0f45 -r ed12248ad791 Framework/Plugins/DatabaseBackendAdapterV3.cpp --- a/Framework/Plugins/DatabaseBackendAdapterV3.cpp Wed Apr 14 10:35:09 2021 +0200 +++ b/Framework/Plugins/DatabaseBackendAdapterV3.cpp Wed Apr 14 11:20:51 2021 +0200 @@ -1725,6 +1725,8 @@ static OrthancPluginErrorCode LookupParent(OrthancPluginDatabaseTransaction* transaction, + uint8_t* existing /* out */, + int64_t* parentId /* out */, int64_t id) { DatabaseBackendAdapterV3::Transaction* t = reinterpret_cast(transaction); @@ -1733,10 +1735,13 @@ { t->GetOutput().Clear(); - int64_t parentId; - if (t->GetBackend().LookupParent(parentId, t->GetManager(), id)) + if (t->GetBackend().LookupParent(*parentId, t->GetManager(), id)) { - t->GetOutput().AnswerInteger64(parentId); + *existing = 1; + } + else + { + *existing = 0; } return OrthancPluginErrorCode_Success; @@ -1833,7 +1838,9 @@ } - static OrthancPluginErrorCode SelectPatientToRecycle(OrthancPluginDatabaseTransaction* transaction) + static OrthancPluginErrorCode SelectPatientToRecycle(OrthancPluginDatabaseTransaction* transaction, + uint8_t* patientAvailable, + int64_t* patientId) { DatabaseBackendAdapterV3::Transaction* t = reinterpret_cast(transaction); @@ -1841,10 +1848,13 @@ { t->GetOutput().Clear(); - int64_t id; - if (t->GetBackend().SelectPatientToRecycle(id, t->GetManager())) + if (t->GetBackend().SelectPatientToRecycle(*patientId, t->GetManager())) { - t->GetOutput().AnswerInteger64(id); + *patientAvailable = 1; + } + else + { + *patientAvailable = 0; } return OrthancPluginErrorCode_Success; @@ -1854,6 +1864,8 @@ static OrthancPluginErrorCode SelectPatientToRecycle2(OrthancPluginDatabaseTransaction* transaction, + uint8_t* patientAvailable, + int64_t* patientId, int64_t patientIdToAvoid) { DatabaseBackendAdapterV3::Transaction* t = reinterpret_cast(transaction); @@ -1862,10 +1874,13 @@ { t->GetOutput().Clear(); - int64_t id; - if (t->GetBackend().SelectPatientToRecycle(id, t->GetManager(), patientIdToAvoid)) + if (t->GetBackend().SelectPatientToRecycle(*patientId, t->GetManager(), patientIdToAvoid)) { - t->GetOutput().AnswerInteger64(id); + *patientAvailable = 1; + } + else + { + *patientAvailable = 0; } return OrthancPluginErrorCode_Success;