Commit 4093dcfb authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

Bug#43254: SQL_SELECT_LIMIT=0 crashes command line client

When asking what database is selected, client expected
to *always* get an answer from the server.

We now handle failure more gracefully.

See comments in ticket for a discussion of what happens,
and how things interlock.


client/mysql.cc:
  Handle empty result-sets gracefully, as opposed
  to just result sets with n>0 items that may themselves
  be empty.
parent 45681525
...@@ -2625,7 +2625,7 @@ static void get_current_db() ...@@ -2625,7 +2625,7 @@ static void get_current_db()
(res= mysql_use_result(&mysql))) (res= mysql_use_result(&mysql)))
{ {
MYSQL_ROW row= mysql_fetch_row(res); MYSQL_ROW row= mysql_fetch_row(res);
if (row[0]) if (row && row[0])
current_db= my_strdup(row[0], MYF(MY_WME)); current_db= my_strdup(row[0], MYF(MY_WME));
mysql_free_result(res); mysql_free_result(res);
} }
......
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