summaryrefslogtreecommitdiff
path: root/modules/extra/m_mysql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/extra/m_mysql.cpp')
-rw-r--r--modules/extra/m_mysql.cpp9
1 files changed, 9 insertions, 0 deletions
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);
}