Fix for bug #9992: mysql_next_result hangs on error

    set net->no_send_error to 0 before execution of each element of
    multiquery statement to provide the sending of error to client
parent eaa7f6ab
...@@ -1655,6 +1655,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1655,6 +1655,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error) while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error)
{ {
char *packet= thd->lex->found_semicolon; char *packet= thd->lex->found_semicolon;
net->no_send_error= 0;
/* /*
Multiple queries exits, execute them individually Multiple queries exits, execute them individually
in embedded server - just store them to be executed later in embedded server - just store them to be executed later
......
...@@ -233,7 +233,7 @@ mysql_simple_prepare(MYSQL *mysql, const char *query) ...@@ -233,7 +233,7 @@ mysql_simple_prepare(MYSQL *mysql, const char *query)
/* Connect to the server */ /* Connect to the server */
static void client_connect() static void client_connect(ulong flag)
{ {
int rc; int rc;
myheader_r("client_connect"); myheader_r("client_connect");
...@@ -251,7 +251,7 @@ static void client_connect() ...@@ -251,7 +251,7 @@ static void client_connect()
if (!(mysql_real_connect(mysql, opt_host, opt_user, if (!(mysql_real_connect(mysql, opt_host, opt_user,
opt_password, opt_db ? opt_db:"test", opt_port, opt_password, opt_db ? opt_db:"test", opt_port,
opt_unix_socket, 0))) opt_unix_socket, flag)))
{ {
opt_silent= 0; opt_silent= 0;
myerror("connection failed"); myerror("connection failed");
...@@ -13478,6 +13478,22 @@ static void print_test_output() ...@@ -13478,6 +13478,22 @@ static void print_test_output()
} }
static void check_mupltiquery_bug9992()
{
MYSQL_RES* res ;
mysql_query(mysql,"SHOW TABLES;SHOW DATABASE;SELECT 1;");
fprintf(stdout, "\n\n!!! check_mupltiquery_bug9992 !!!\n");
do
{
if (!(res= mysql_store_result(mysql)))
return;
mysql_free_result(res);
} while (!mysql_next_result(mysql));
fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
return;
}
/*************************************************************************** /***************************************************************************
main routine main routine
***************************************************************************/ ***************************************************************************/
...@@ -13499,7 +13515,7 @@ int main(int argc, char **argv) ...@@ -13499,7 +13515,7 @@ int main(int argc, char **argv)
(char**) embedded_server_groups)) (char**) embedded_server_groups))
DIE("Can't initialize MySQL server"); DIE("Can't initialize MySQL server");
client_connect(); /* connect to server */ client_connect(0); /* connect to server */
total_time= 0; total_time= 0;
for (iter_count= 1; iter_count <= opt_count; iter_count++) for (iter_count= 1; iter_count <= opt_count; iter_count++)
...@@ -13543,6 +13559,10 @@ int main(int argc, char **argv) ...@@ -13543,6 +13559,10 @@ int main(int argc, char **argv)
} }
client_disconnect(); /* disconnect from server */ client_disconnect(); /* disconnect from server */
client_connect(CLIENT_MULTI_STATEMENTS);
check_mupltiquery_bug9992();
client_disconnect();
free_defaults(defaults_argv); free_defaults(defaults_argv);
print_test_output(); print_test_output();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment