From 5c55da88e83ef98c01cc7787f0f811919564e07d Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 25 Sep 2017 15:21:20 +0200 Subject: [PATCH] Fix unique constraint matching for UPDATE downtime/comment runtime tables in DB IDO fixes #5623 fixes #5603 refs #5636 --- lib/db_ido/dbevents.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index d843c7fec..28f6604bb 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -377,7 +377,8 @@ void DbEvents::AddCommentInternal(std::vector& queries, const Comment:: query1.WhereCriteria->Set("object_id", checkable); query1.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time)); query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ - query1.WhereCriteria->Set("name", comment->GetName()); + /* Match the unique constraint. */ + query1.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId()); } else { query1.Table = "commenthistory"; query1.Type = DbQueryInsert; @@ -522,9 +523,8 @@ void DbEvents::AddDowntimeInternal(std::vector& queries, const Downtime query1.WhereCriteria->Set("object_id", checkable); query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime())); query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ - query1.WhereCriteria->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime())); - query1.WhereCriteria->Set("scheduled_end_time", DbValue::FromTimestamp(downtime->GetEndTime())); - query1.WhereCriteria->Set("name", downtime->GetName()); + /* Match the unique constraint. */ + query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId()); } else { query1.Table = "downtimehistory"; query1.Type = DbQueryInsert;