diff options
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r-- | client/mysqltest.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index f6f6f469e8c..c1ff16e5d88 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2746,8 +2746,13 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags) append_result(ds, res); } - /* Add all warnings to the result */ - if (!disable_warnings && mysql_warning_count(mysql)) + /* + Add all warnings to the result. We can't do this if we are in + the middle of processing results from multi-statement, because + this will break protocol. + */ + if (!disable_warnings && !mysql_more_results(mysql) && + mysql_warning_count(mysql)) { MYSQL_RES *warn_res=0; uint count= mysql_warning_count(mysql); @@ -3363,6 +3368,13 @@ static void run_query_stmt_handle_warnings(MYSQL *mysql, DYNAMIC_STRING *ds) if (!disable_warnings && (count= mysql_warning_count(mysql))) { + /* + If one day we will support execution of multi-statements + through PS API we should not issue SHOW WARNINGS until + we have not read all results... + */ + DBUG_ASSERT(!mysql_more_results(mysql)); + if (mysql_real_query(mysql, "SHOW WARNINGS", 13) == 0) { MYSQL_RES *warn_res= mysql_store_result(mysql); |