From 518182ac9204f815258b0de91b3f884d8efa1502 Mon Sep 17 00:00:00 2001 From: DukePyrolator Date: Sun, 30 Jun 2013 05:28:01 +0200 Subject: m_mysql: handle multiple result sets returned from multiple statements or procedure calls --- modules/extra/m_mysql.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/extra/m_mysql.cpp') diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index aefd643b8..3b8715c52 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -332,6 +332,15 @@ Result MySQLService::RunQuery(const Query &query) MYSQL_RES *res = mysql_store_result(this->sql); unsigned int id = mysql_insert_id(this->sql); + /* because we enabled CLIENT_MULTI_RESULTS in our options + * a multiple statement or a procedure call can return + * multiple result sets. + * we must process them all before the next query. + */ + + while (!mysql_next_result(this->sql)) + mysql_free_result(mysql_store_result(this->sql)); + this->Lock.Unlock(); return MySQLResult(id, query, real_query, res); } -- cgit