]> granicus.if.org Git - icinga2/commitdiff
Fix: IDO tries to execute empty UPDATE queries
authorGunnar Beutner <gunnar@beutner.name>
Wed, 28 Oct 2015 06:45:18 +0000 (07:45 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 28 Oct 2015 06:46:04 +0000 (07:46 +0100)
fixes #10473

lib/db_ido_mysql/idomysqlconnection.cpp
lib/db_ido_pgsql/idopgsqlconnection.cpp

index a189220c21a15f7a247218fb95b317d766e44167..237cf6f2ead0534f0c122da4e6c38d5729c90d2b 100644 (file)
@@ -805,6 +805,9 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
        if (type == DbQueryInsert || type == DbQueryUpdate) {
                std::ostringstream colbuf, valbuf;
 
+               if (type == DbQueryUpdate && query.Fields->GetLength() == 0)
+                       return;
+
                ObjectLock olock(query.Fields);
 
                bool first = true;
index 7866c1c1f2e06f6b0067ec0b0ae0463ed2f90469..8c7a104871910979e9bbefc84eeb21c1f9b4b290 100644 (file)
@@ -684,6 +684,9 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
        if (type == DbQueryInsert || type == DbQueryUpdate) {
                std::ostringstream colbuf, valbuf;
 
+               if (type == DbQueryUpdate && query.Fields->GetLength() == 0)
+                       return;
+
                ObjectLock olock(query.Fields);
 
                Value value;