You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
CONC-632
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:
@@ -4240,13 +4240,22 @@ int STDCALL mysql_reset_connection(MYSQL *mysql)
|
|||||||
|
|
||||||
/* skip result sets */
|
/* skip result sets */
|
||||||
if (mysql->status == MYSQL_STATUS_USE_RESULT ||
|
if (mysql->status == MYSQL_STATUS_USE_RESULT ||
|
||||||
mysql->status == MYSQL_STATUS_GET_RESULT ||
|
mysql->status == MYSQL_STATUS_GET_RESULT)
|
||||||
mysql->status & SERVER_MORE_RESULTS_EXIST)
|
|
||||||
{
|
{
|
||||||
mthd_my_skip_result(mysql);
|
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);
|
rc= ma_simple_command(mysql, COM_RESET_CONNECTION, 0, 0, 0, 0);
|
||||||
if (rc && mysql->options.reconnect)
|
if (rc && mysql->options.reconnect)
|
||||||
{
|
{
|
||||||
|
@@ -1922,7 +1922,43 @@ static int test_conc490(MYSQL *my __attribute__((unused)))
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int test_conc632(MYSQL *my __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MYSQL *mysql= mysql_init(NULL);
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!my_test_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_REMEMBER_OPTIONS))
|
||||||
|
{
|
||||||
|
diag("Connection failed. Error: %s", mysql_error(mysql));
|
||||||
|
mysql_close(mysql);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "CREATE OR REPLACE PROCEDURE conc632() "
|
||||||
|
"BEGIN "
|
||||||
|
" SELECT 1;"
|
||||||
|
" SELECT 2;"
|
||||||
|
"END");
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "CALL conc632()");
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
rc= mysql_reset_connection(mysql);
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
rc= mysql_ping(mysql);
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "DROP PROCEDURE conc632");
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
mysql_close(mysql);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
|
{"test_conc632", test_conc632, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_conc490", test_conc490, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_conc490", test_conc490, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_gtid", test_gtid, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_gtid", test_gtid, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc496", test_conc496, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc496", test_conc496, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
Reference in New Issue
Block a user