# HG changeset patch # User Alain Mazy # Date 1748247488 -7200 # Node ID 88d016b2a1170fe7aaee84a7d3265d204124a5f8 # Parent fb71c140ce2d4db59f787306c77158c6ab0dfad6 handle null customdata diff -r fb71c140ce2d -r 88d016b2a117 Framework/Plugins/IndexBackend.cpp --- a/Framework/Plugins/IndexBackend.cpp Thu May 22 11:42:44 2025 +0200 +++ b/Framework/Plugins/IndexBackend.cpp Mon May 26 10:18:08 2025 +0200 @@ -4373,9 +4373,10 @@ const std::string& key, const std::string& value) { + // TODO: that probably needs to be adapted in ODBC and MySQL DatabaseManager::CachedStatement statement( STATEMENT_FROM_HERE, manager, - "INSERT INTO KeyValueStores VALUES(${storeId}, ${key}, ${value})"); + "INSERT INTO KeyValueStores VALUES(${storeId}, ${key}, ${value}) ON CONFLICT (storeId, key) DO UPDATE SET value = EXCLUDED.value;"); Dictionary args; @@ -4619,7 +4620,7 @@ response.mutable_get_attachment()->mutable_attachment()->set_compression_type(statement.ReadInteger32(4)); response.mutable_get_attachment()->mutable_attachment()->set_compressed_size(statement.ReadInteger64(5)); response.mutable_get_attachment()->mutable_attachment()->set_compressed_hash(statement.ReadString(6)); - response.mutable_get_attachment()->mutable_attachment()->set_custom_data(statement.ReadString(8)); + response.mutable_get_attachment()->mutable_attachment()->set_custom_data(statement.ReadStringOrNull(8)); return true; } @@ -4639,7 +4640,14 @@ Dictionary args; args.SetUtf8Value("uuid", attachmentUuid); - args.SetUtf8Value("customData", customData); + if (customData.empty()) + { + args.SetUtf8NullValue("customData"); + } + else + { + args.SetUtf8Value("customData", customData); + } statement.Execute(args); }