Mercurial > hg > orthanc
changeset 6131:24bf08f02e55 attach-custom-data
merge
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Wed, 21 May 2025 21:31:14 +0200 |
parents | 31d41a52ac2f (current diff) 08745ddaee12 (diff) |
children | 38c388f7eaed |
files | |
diffstat | 4 files changed, 28 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed May 21 21:29:52 2025 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed May 21 21:31:14 2025 +0200 @@ -4737,11 +4737,11 @@ if (lock.GetContext().GetIndex().GetKeyValue(value, parameters.storeId, parameters.key)) { CopyToMemoryBuffer(*parameters.target, value.size() > 0 ? value.c_str() : NULL, value.size()); - *parameters.isExisting = true; + *parameters.found = true; } else { - *parameters.isExisting = false; + *parameters.found = false; } } @@ -4769,11 +4769,11 @@ if (lock.GetContext().GetIndex().DequeueValue(value, parameters.queueId, Plugins::Convert(parameters.origin))) { CopyToMemoryBuffer(*parameters.target, value.size() > 0 ? value.c_str() : NULL, value.size()); - *parameters.isExisting = true; + *parameters.found = true; } else { - *parameters.isExisting = false; + *parameters.found = false; } }
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Wed May 21 21:29:52 2025 +0200 +++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Wed May 21 21:31:14 2025 +0200 @@ -9970,7 +9970,7 @@ typedef struct { - uint8_t* isExisting; + uint8_t* found; OrthancPluginMemoryBuffer* target; const char* storeId; const char* key; @@ -9980,7 +9980,7 @@ * @brief Get the value associated to this key in the key-value store. * * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). - * @param isExisting Pointer to a Boolean that is set to "true" iff. the key exists in the store + * @param found Pointer to a Boolean that is set to "true" iff. the key exists in the store * @param target Memory buffer where to store the retrieved value * @param storeId A unique identifier identifying both the plugin and the store * @param key The key of the value to retrieve from the store (note: storeId + key must be unique) @@ -9988,13 +9988,13 @@ **/ ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginGetKeyValue( OrthancPluginContext* context, - uint8_t* isExisting, + uint8_t* found, OrthancPluginMemoryBuffer* target, /* out */ const char* storeId, /* in */ const char* key /* in */) { _OrthancPluginGetKeyValue params; - params.isExisting = isExisting; + params.found = found; params.target = target; params.storeId = storeId; params.key = key; @@ -10168,7 +10168,7 @@ typedef struct { - uint8_t* isExisting; + uint8_t* found; OrthancPluginMemoryBuffer* target; const char* queueId; OrthancPluginQueueOrigin origin; @@ -10178,7 +10178,7 @@ * @brief Dequeue a value from a queue. * * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). - * @param isExisting Pointer to a Boolean that is set to "true" iff. a value has been dequeued + * @param found Pointer to a Boolean that is set to "true" iff. a value has been dequeued * @param target Memory buffer where to store the value that has been retrieved from the queue * @param queueId A unique identifier identifying both the plugin and the queue * @param origin The queue position where the value is removed (back for LIFO, front for FIFO) @@ -10186,13 +10186,13 @@ **/ ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginDequeueValue( OrthancPluginContext* context, - uint8_t* isExisting, /* out */ - OrthancPluginMemoryBuffer* target, /* out */ - const char* queueId, /* in */ - OrthancPluginQueueOrigin origin /* in */) + uint8_t* found, /* out */ + OrthancPluginMemoryBuffer* target, /* out */ + const char* queueId, /* in */ + OrthancPluginQueueOrigin origin /* in */) { _OrthancPluginDequeueValue params; - params.isExisting = isExisting; + params.found = found; params.target = target; params.queueId = queueId; params.origin = origin;
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Wed May 21 21:29:52 2025 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Wed May 21 21:31:14 2025 +0200 @@ -4437,16 +4437,16 @@ bool KeyValueStore::GetValue(std::string& value, const std::string& key) { - uint8_t isExisting = false; + uint8_t found = false; OrthancPlugins::MemoryBuffer valueBuffer; - OrthancPluginErrorCode code = OrthancPluginGetKeyValue(OrthancPlugins::GetGlobalContext(), &isExisting, + OrthancPluginErrorCode code = OrthancPluginGetKeyValue(OrthancPlugins::GetGlobalContext(), &found, *valueBuffer, storeId_.c_str(), key.c_str()); if (code != OrthancPluginErrorCode_Success) { ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); } - else if (isExisting) + else if (found) { valueBuffer.ToString(value); return true; @@ -4499,17 +4499,17 @@ bool Queue::PopInternal(std::string& value, OrthancPluginQueueOrigin origin) { - uint8_t isExisting = false; + uint8_t found = false; OrthancPlugins::MemoryBuffer valueBuffer; - OrthancPluginErrorCode code = OrthancPluginDequeueValue(OrthancPlugins::GetGlobalContext(), &isExisting, + OrthancPluginErrorCode code = OrthancPluginDequeueValue(OrthancPlugins::GetGlobalContext(), &found, *valueBuffer, queueId_.c_str(), origin); if (code != OrthancPluginErrorCode_Success) { ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code); } - else if (isExisting) + else if (found) { valueBuffer.ToString(value); return true;
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed May 21 21:29:52 2025 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Wed May 21 21:31:14 2025 +0200 @@ -3644,6 +3644,13 @@ throw OrthancException(ErrorCode_DatabasePlugin); } + if (limit_ != 0 && + keys_.size() > limit_) + { + // The database plugin has returned too many key-value pairs + throw OrthancException(ErrorCode_DatabasePlugin); + } + if (keys_.empty() && values_.empty()) {