diff options
author | DukePyrolator <DukePyrolator@anope.org> | 2013-06-30 05:28:01 +0200 |
---|---|---|
committer | DukePyrolator <DukePyrolator@anope.org> | 2013-06-30 05:28:01 +0200 |
commit | 518182ac9204f815258b0de91b3f884d8efa1502 (patch) | |
tree | a7d7e7308d52bc27b430420101651747204e487d /modules/extra/m_mysql.cpp | |
parent | 7d0e0633009d38c0daff4969cf0928581a35bcaf (diff) |
m_mysql: handle multiple result sets returned from multiple statements or procedure calls
Diffstat (limited to 'modules/extra/m_mysql.cpp')
-rw-r--r-- | modules/extra/m_mysql.cpp | 9 |
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); } |