[icinga-checkins] icinga.org: icinga2/fix/ido-mysql-config-loop-12147: Add debug output

git at icinga.org git at icinga.org
Mon Aug 1 17:52:39 CEST 2016


Module: icinga2
Branch: fix/ido-mysql-config-loop-12147
Commit: b44615ab29bc07e3e8df01ca04995f5033667f51
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b44615ab29bc07e3e8df01ca04995f5033667f51

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon Aug  1 17:52:22 2016 +0200

Add debug output

---

 lib/db_ido_mysql/idomysqlconnection.cpp |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp
index 5efda95..6154077 100644
--- a/lib/db_ido_mysql/idomysqlconnection.cpp
+++ b/lib/db_ido_mysql/idomysqlconnection.cpp
@@ -831,16 +831,22 @@ void IdoMysqlConnection::ExecuteMultipleQueries(const std::vector<DbQuery>& quer
 
 bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
 {
-	if (query.Object && !IsIDCacheValid())
+	if (query.Object && !IsIDCacheValid()) {
+		Log(LogCritical, "IdoMysqlConnection")
+		    << "Invalid object cache for table '" << query.Table << "'.";
 		return false;
+	}
 
 	if (query.WhereCriteria) {
 		ObjectLock olock(query.WhereCriteria);
 		Value value;
 
 		BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
-			if (!FieldToEscapedString(kv.first, kv.second, &value))
+			if (!FieldToEscapedString(kv.first, kv.second, &value)) {
+				Log(LogCritical, "IdoMysqlConnection")
+				    << "Where: Cannot escape field '" << kv.first << "' for table '" << query.Table << "'.";
 				return false;
+			}
 		}
 	}
 
@@ -853,8 +859,11 @@ bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
 			if (kv.second.IsEmpty() && !kv.second.IsString())
 				continue;
 
-			if (!FieldToEscapedString(kv.first, kv.second, &value))
+			if (!FieldToEscapedString(kv.first, kv.second, &value)) {
+				Log(LogCritical, "IdoMysqlConnection")
+				    << "Where: Cannot escape field '" << kv.first << "' for table '" << query.Table << "'.";
 				return false;
+			}
 		}
 	}
 



More information about the icinga-checkins mailing list