Merge pull request #8241 from Icinga/bugfix/duplicate-entry

IDO: customvariables: fix duplicate entry error
This commit is contained in:
Noah Hilverling 2020-09-21 13:57:39 +02:00 committed by GitHub
commit b1e52be8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));
}
}