From: Jean Flach Date: Mon, 6 Nov 2017 09:59:44 +0000 (+0100) Subject: Remove unnecessary keys from where clauses X-Git-Tag: v2.8.0~19^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e83ddbd8b224bd40f5bd8a9838ccaf3faee0e42a;p=icinga2 Remove unnecessary keys from where clauses --- diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index 315bd5384..0b2c75430 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -375,10 +375,8 @@ void DbEvents::AddCommentInternal(std::vector& queries, const Comment:: query1.WhereCriteria = new Dictionary(); query1.WhereCriteria->Set("object_id", checkable); + query1.WhereCriteria->Set("name", comment->GetName()); query1.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time)); - query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ - /* Match the unique constraint. */ - query1.WhereCriteria->Set("internal_comment_id", comment->GetLegacyId()); } else { query1.Table = "commenthistory"; query1.Type = DbQueryInsert; @@ -410,7 +408,6 @@ void DbEvents::RemoveCommentInternal(std::vector& queries, const Commen query1.WhereCriteria = new Dictionary(); query1.WhereCriteria->Set("object_id", checkable); query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time)); - query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ query1.WhereCriteria->Set("name", comment->GetName()); queries.push_back(query1); @@ -431,7 +428,6 @@ void DbEvents::RemoveCommentInternal(std::vector& queries, const Commen query2.WhereCriteria = new Dictionary(); query2.WhereCriteria->Set("object_id", checkable); query2.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time)); - query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ query2.WhereCriteria->Set("name", comment->GetName()); queries.push_back(query2); } @@ -521,10 +517,8 @@ void DbEvents::AddDowntimeInternal(std::vector& queries, const Downtime query1.WhereCriteria = new Dictionary(); query1.WhereCriteria->Set("object_id", checkable); + query1.WhereCriteria->Set("name", downtime->GetName()); query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime())); - query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ - /* Match the unique constraint. */ - query1.WhereCriteria->Set("internal_downtime_id", downtime->GetLegacyId()); } else { query1.Table = "downtimehistory"; query1.Type = DbQueryInsert;