[icinga-checkins] icinga.org: icinga2/support/2.5: Revert "DB IDO: Make sure that all result sets are processed before sending another query "

git at icinga.org git at icinga.org
Tue Dec 6 10:53:40 CET 2016


Module: icinga2
Branch: support/2.5
Commit: 79ecda5edf2ff014c59f8b25e684a51437ee2968
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=79ecda5edf2ff014c59f8b25e684a51437ee2968

Author: Gunnar Beutner <gunnar.beutner at icinga.com>
Date:   Mon Nov 28 12:13:34 2016 +0100

Revert "DB IDO: Make sure that all result sets are processed before sending another query"

This reverts commit ad0604d7ea1abb78f853d13ffcde7509542f7878.

refs #12597

---

 lib/db_ido_mysql/idomysqlconnection.cpp |   25 +++++--------------------
 lib/db_ido_mysql/idomysqlconnection.hpp |    6 ------
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp
index 7750059..486a816 100644
--- a/lib/db_ido_mysql/idomysqlconnection.cpp
+++ b/lib/db_ido_mysql/idomysqlconnection.cpp
@@ -512,21 +512,20 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
 			);
 		}
 
-		std::vector<IdoMysqlResultInfo> resultSets;
-
 		for (std::vector<IdoAsyncQuery>::size_type i = offset; i < offset + count; i++) {
 			const IdoAsyncQuery& aq = queries[i];
 
 			MYSQL_RES *result = mysql_store_result(&m_Connection);
 
-			int affectedRows = mysql_affected_rows(&m_Connection);
+			m_AffectedRows = mysql_affected_rows(&m_Connection);
+
 			IdoMysqlResult iresult;
 
 			if (!result) {
 				if (mysql_field_count(&m_Connection) > 0) {
 					std::ostringstream msgbuf;
 					String message = mysql_error(&m_Connection);
-					msgbuf << "Error \"" << message << "\" when checking field count \"" << aq.Query << "\"";
+					msgbuf << "Error \"" << message << "\" when executing query \"" << aq.Query << "\"";
 					Log(LogCritical, "IdoMysqlConnection", msgbuf.str());
 
 					BOOST_THROW_EXCEPTION(
@@ -538,11 +537,8 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
 			} else
 				iresult = IdoMysqlResult(result, std::ptr_fun(mysql_free_result));
 
-			IdoMysqlResultInfo resultInfo;
-			resultInfo.Result = iresult;
-			resultInfo.AffectedRows = affectedRows;
-
-			resultSets.push_back(resultInfo);
+			if (aq.Callback)
+				aq.Callback(iresult);
 
 			if (mysql_next_result(&m_Connection) > 0) {
 				std::ostringstream msgbuf;
@@ -558,17 +554,6 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
 			}
 		}
 
-		for (std::vector<IdoAsyncQuery>::size_type i = offset; i < offset + count; i++) {
-			const IdoAsyncQuery& aq = queries[i];
-
-			const IdoMysqlResultInfo ri = resultSets[i - offset];
-
-			m_AffectedRows = ri.AffectedRows;
-
-			if (aq.Callback)
-				aq.Callback(ri.Result);
-		}
-
 		offset += count;
 	}
 }
diff --git a/lib/db_ido_mysql/idomysqlconnection.hpp b/lib/db_ido_mysql/idomysqlconnection.hpp
index ef38418..5920de6 100644
--- a/lib/db_ido_mysql/idomysqlconnection.hpp
+++ b/lib/db_ido_mysql/idomysqlconnection.hpp
@@ -39,12 +39,6 @@ struct IdoAsyncQuery
 	IdoAsyncCallback Callback;
 };
 
-struct IdoMysqlResultInfo
-{
-	IdoMysqlResult Result;
-	int AffectedRows;
-};
-
 /**
  * An IDO MySQL database connection.
  *



More information about the icinga-checkins mailing list