From db8698100db7ba2dcee88e3bfd25bdc6b3a2266f Mon Sep 17 00:00:00 2001 From: unknown <konstantin@mysql.com> Date: Sat, 19 Nov 2005 19:00:02 +0300 Subject: [PATCH] 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. --- sql/sql_cursor.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index fc169fe18e8..89c160cd70a 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -661,11 +661,10 @@ Materialized_cursor::~Materialized_cursor() bool Select_materialize::send_fields(List<Item> &list, uint flags) { - bool rc; DBUG_ASSERT(table == 0); if (create_result_table(unit->thd, unit->get_unit_column_types(), FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, "")) return TRUE; - return rc; + return FALSE; } -- 2.30.9