1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge 5.2->5.3

This commit is contained in:
Igor Babaev
2012-02-26 02:42:45 -08:00
4 changed files with 152 additions and 10 deletions

View File

@@ -105,7 +105,7 @@ static int return_zero_rows(JOIN *join, select_result *res,
List<TABLE_LIST> &tables,
List<Item> &fields, bool send_row,
ulonglong select_options, const char *info,
Item *having);
Item *having, List<Item> &all_fields);
static COND *build_equal_items(THD *thd, COND *cond,
COND_EQUAL *inherited,
List<TABLE_LIST> *join_list,
@@ -2177,7 +2177,7 @@ JOIN::exec()
send_row_on_empty_set(),
select_options,
zero_result_cause,
having ? having : tmp_having);
having ? having : tmp_having, all_fields);
DBUG_VOID_RETURN;
}
@@ -10440,7 +10440,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
static int
return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
List<Item> &fields, bool send_row, ulonglong select_options,
const char *info, Item *having)
const char *info, Item *having, List<Item> &all_fields)
{
DBUG_ENTER("return_zero_rows");
@@ -10470,6 +10470,14 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
if (!table->is_jtbm())
mark_as_null_row(table->table); // All fields are NULL
}
List_iterator_fast<Item> it(all_fields);
Item *item;
/*
Inform all items (especially aggregating) to calculate HAVING correctly,
also we will need it for sending results.
*/
while ((item= it++))
item->no_rows_in_result();
if (having && having->val_int() == 0)
send_row=0;
}
@@ -10478,13 +10486,7 @@ return_zero_rows(JOIN *join, select_result *result, List<TABLE_LIST> &tables,
{
bool send_error= FALSE;
if (send_row)
{
List_iterator_fast<Item> it(fields);
Item *item;
while ((item= it++))
item->no_rows_in_result();
send_error= result->send_data(fields) > 0;
}
if (!send_error)
result->send_eof(); // Should be safe
}