# HG changeset patch # User Sebastien Jodogne # Date 1616437527 -3600 # Node ID cfdd1f59ff6fe21bb1611f94d45acf02197c3299 # Parent 27c07dbf6b4fe5fadf39f12fe51934bdcf352058 fix OrthancCDatabasePlugin.h diff -r 27c07dbf6b4f -r cfdd1f59ff6f OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Fri Mar 19 10:52:22 2021 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp Mon Mar 22 19:25:27 2021 +0100 @@ -725,9 +725,20 @@ ResourceType& type, const std::string& publicId) ORTHANC_OVERRIDE { - CheckSuccess(that_.backend_.lookupResource(transaction_, Plugins::Convert(type), publicId.c_str())); + uint8_t existing; + OrthancPluginResourceType t; + CheckSuccess(that_.backend_.lookupResource(transaction_, &existing, &id, &t, publicId.c_str())); CheckNoEvent(); - return ReadSingleInt64Answer(id); + + if (existing == 0) + { + return false; + } + else + { + type = Plugins::Convert(t); + return true; + } } diff -r 27c07dbf6b4f -r cfdd1f59ff6f OrthancServer/Plugins/Include/orthanc/OrthancCDatabasePlugin.h --- a/OrthancServer/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Fri Mar 19 10:52:22 2021 +0100 +++ b/OrthancServer/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Mon Mar 22 19:25:27 2021 +0100 @@ -1221,7 +1221,7 @@ uint8_t* target /* out */, int64_t resourceId); - /* Answer is read using "readAnswerInt32()" */ + /* Answers are read using "readAnswerInt32()" */ OrthancPluginErrorCode (*listAvailableAttachments) (OrthancPluginDatabaseTransaction* transaction, int64_t internalId); @@ -1255,13 +1255,14 @@ int64_t id, int32_t metadata); - /* Answer is read using "readAnswerInt64()" */ + /* Answer is read using "readAnswerInt64()" -- TODO */ OrthancPluginErrorCode (*lookupParent) (OrthancPluginDatabaseTransaction* transaction, int64_t id); - /* Answer is read using "readAnswerInt64()" */ OrthancPluginErrorCode (*lookupResource) (OrthancPluginDatabaseTransaction* transaction, - OrthancPluginResourceType level, + uint8_t* isExisting /* out */, + int64_t* id /* out */, + OrthancPluginResourceType* type /* out */, const char* publicId); /* Answers are read using "readAnswerMatchingResource()" */ @@ -1279,10 +1280,10 @@ OrthancPluginResourceType* type /* out */, const char* publicId); - /* Answer is read using "readAnswerInt64()" */ + /* Answer is read using "readAnswerInt64()" -- TODO */ OrthancPluginErrorCode (*selectPatientToRecycle) (OrthancPluginDatabaseTransaction* transaction); - /* Answer is read using "readAnswerInt64()" */ + /* Answer is read using "readAnswerInt64()" -- TODO */ OrthancPluginErrorCode (*selectPatientToRecycle2) (OrthancPluginDatabaseTransaction* transaction, int64_t patientIdToAvoid); diff -r 27c07dbf6b4f -r cfdd1f59ff6f OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Fri Mar 19 10:52:22 2021 +0100 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Mar 22 19:25:27 2021 +0100 @@ -2679,8 +2679,12 @@ } }; - Operations operations(maximumStorageSize, maximumPatientCount); - Apply(operations); + if (maximumStorageSize != 0 || + maximumPatientCount != 0) + { + Operations operations(maximumStorageSize, maximumPatientCount); + Apply(operations); + } }