From bd2b565a1c6a76cc5fdc479ce8e816a7386ed193 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 17 Sep 2020 10:35:44 +0200 Subject: [PATCH] IDO: customvariables: fix duplicate entry error --- lib/db_ido/dbobject.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp index c48739ede..28ef722b2 100644 --- a/lib/db_ido/dbobject.cpp +++ b/lib/db_ido/dbobject.cpp @@ -234,8 +234,9 @@ void DbObject::SendVarsConfigUpdateHeavy() DbQuery query3; query3.Table = "customvariables"; - query3.Type = DbQueryInsert; + query3.Type = DbQueryInsert | DbQueryUpdate; query3.Category = DbCatConfig; + query3.Fields = new Dictionary({ { "varname", kv.first }, { "varvalue", value }, @@ -244,6 +245,13 @@ void DbObject::SendVarsConfigUpdateHeavy() { "object_id", obj }, { "instance_id", 0 } /* DbConnection class fills in real ID */ }); + + query3.WhereCriteria = new Dictionary({ + { "object_id", obj }, + { "config_type", 1 }, + { "varname", kv.first } + }); + queries.emplace_back(std::move(query3)); } }