[icinga-checkins] icinga.org: icinga2/feature/ido-groups: Implement support for upserts which are not related to ConfigObjects

git at icinga.org git at icinga.org
Fri Jul 22 07:59:00 CEST 2016


Module: icinga2
Branch: feature/ido-groups
Commit: 99916fa86b165233f63c21ace807e28b3ee9b8bb
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=99916fa86b165233f63c21ace807e28b3ee9b8bb

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Jul 22 07:58:35 2016 +0200

Implement support for upserts which are not related to ConfigObjects

---

 lib/db_ido_mysql/idomysqlconnection.cpp |   12 ++++++------
 lib/db_ido_pgsql/idopgsqlconnection.cpp |   12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp
index 6e66075..219cd78 100644
--- a/lib/db_ido_mysql/idomysqlconnection.cpp
+++ b/lib/db_ido_mysql/idomysqlconnection.cpp
@@ -929,12 +929,12 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
 	if ((type & DbQueryInsert) && (type & DbQueryUpdate)) {
 		bool hasid = false;
 
-		ASSERT(query.Object);
-
-		if (query.ConfigUpdate)
-			hasid = GetConfigUpdate(query.Object);
-		else if (query.StatusUpdate)
-			hasid = GetStatusUpdate(query.Object);
+		if (query.Object) {
+			if (query.ConfigUpdate)
+				hasid = GetConfigUpdate(query.Object);
+			else if (query.StatusUpdate)
+				hasid = GetStatusUpdate(query.Object);
+		}
 
 		if (!hasid)
 			upsert = true;
diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp
index c9e1ab0..3477678 100644
--- a/lib/db_ido_pgsql/idopgsqlconnection.cpp
+++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp
@@ -786,12 +786,12 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
 	if ((type & DbQueryInsert) && (type & DbQueryUpdate)) {
 		bool hasid = false;
 
-		ASSERT(query.Object);
-
-		if (query.ConfigUpdate)
-			hasid = GetConfigUpdate(query.Object);
-		else if (query.StatusUpdate)
-			hasid = GetStatusUpdate(query.Object);
+		if (query.Object) {
+			if (query.ConfigUpdate)
+				hasid = GetConfigUpdate(query.Object);
+			else if (query.StatusUpdate)
+				hasid = GetStatusUpdate(query.Object);
+		}
 
 		if (!hasid)
 			upsert = true;



More information about the icinga-checkins mailing list