1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00
When resetting the connection with mysql reset_connection(), the
server_status must be checked and any other resultsets that mayi
exist must be removed.
This commit is contained in:
Georg Richter
2023-02-08 11:46:39 +01:00
parent c5179762c2
commit 75439c0f39
2 changed files with 48 additions and 3 deletions

View File

@@ -4240,13 +4240,22 @@ int STDCALL mysql_reset_connection(MYSQL *mysql)
/* skip result sets */
if (mysql->status == MYSQL_STATUS_USE_RESULT ||
mysql->status == MYSQL_STATUS_GET_RESULT ||
mysql->status & SERVER_MORE_RESULTS_EXIST)
mysql->status == MYSQL_STATUS_GET_RESULT)
{
mthd_my_skip_result(mysql);
mysql->status= MYSQL_STATUS_READY;
}
if (mysql->server_status & SERVER_MORE_RESULTS_EXIST)
{
while (mysql_next_result(mysql))
{
MYSQL_RES *res= mysql_use_result(mysql);
mysql_free_result(res);
}
}
mysql->status= MYSQL_STATUS_READY;
rc= ma_simple_command(mysql, COM_RESET_CONNECTION, 0, 0, 0, 0);
if (rc && mysql->options.reconnect)
{