Commit 4ca413e9 authored by unknown's avatar unknown

A fix for Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when

COUNT(*) is 0" (the test case has been pushed already)


sql/sql_cursor.cc:
  Fix a return of an unitialized variable: return_zero_rows
  checks the return value of send_fields and in case it's 1
  doesn't call send_data. This caused creation of an empty result 
  set for the case when there is a cursor against a select with a 
  group function and no matching rows.
parent 6ba79a25
...@@ -661,11 +661,10 @@ Materialized_cursor::~Materialized_cursor() ...@@ -661,11 +661,10 @@ Materialized_cursor::~Materialized_cursor()
bool Select_materialize::send_fields(List<Item> &list, uint flags) bool Select_materialize::send_fields(List<Item> &list, uint flags)
{ {
bool rc;
DBUG_ASSERT(table == 0); DBUG_ASSERT(table == 0);
if (create_result_table(unit->thd, unit->get_unit_column_types(), if (create_result_table(unit->thd, unit->get_unit_column_types(),
FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, "")) FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, ""))
return TRUE; return TRUE;
return rc; return FALSE;
} }
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