From 26e9e13c2618aad057a369c32bbb622fe3b6726d Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Fri, 27 May 2005 18:01:09 +0500 Subject: [PATCH] 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 --- sql/sql_parse.cc | 1 + tests/mysql_client_test.c | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5a06364cd22..7a3d3073520 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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) { char *packet= thd->lex->found_semicolon; + net->no_send_error= 0; /* Multiple queries exits, execute them individually in embedded server - just store them to be executed later diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 95db383bbb6..9a8ee44c54c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -233,7 +233,7 @@ mysql_simple_prepare(MYSQL *mysql, const char *query) /* Connect to the server */ -static void client_connect() +static void client_connect(ulong flag) { int rc; myheader_r("client_connect"); @@ -251,7 +251,7 @@ static void client_connect() if (!(mysql_real_connect(mysql, opt_host, opt_user, opt_password, opt_db ? opt_db:"test", opt_port, - opt_unix_socket, 0))) + opt_unix_socket, flag))) { opt_silent= 0; myerror("connection failed"); @@ -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 ***************************************************************************/ @@ -13499,7 +13515,7 @@ int main(int argc, char **argv) (char**) embedded_server_groups)) DIE("Can't initialize MySQL server"); - client_connect(); /* connect to server */ + client_connect(0); /* connect to server */ total_time= 0; for (iter_count= 1; iter_count <= opt_count; iter_count++) @@ -13543,6 +13559,10 @@ int main(int argc, char **argv) } client_disconnect(); /* disconnect from server */ + + client_connect(CLIENT_MULTI_STATEMENTS); + check_mupltiquery_bug9992(); + client_disconnect(); free_defaults(defaults_argv); print_test_output();