1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.2' into 10.2-mdev9864

This commit is contained in:
Galina Shalygina
2016-05-08 23:04:41 +03:00
parent e09b1f2a22
commit be1d06c8a5
380 changed files with 21974 additions and 6245 deletions

View File

@ -436,8 +436,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit);
saved_error= join->prepare(&sl->ref_pointer_array,
sl->table_list.first,
saved_error= join->prepare(sl->table_list.first,
sl->with_wild,
sl->where,
(can_skip_order_by ? 0 :
@ -646,8 +645,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
fake_select_lex->n_child_sum_items+= global_parameters()->n_sum_items;
saved_error= fake_select_lex->join->
prepare(&fake_select_lex->ref_pointer_array,
fake_select_lex->table_list.first,
prepare(fake_select_lex->table_list.first,
0, 0,
global_parameters()->order_list.elements, // og_num
global_parameters()->order_list.first, // order
@ -702,7 +700,7 @@ bool st_select_lex_unit::optimize()
{
item->assigned(0); // We will reinit & rexecute unit
item->reset();
if (table->created)
if (table->is_created())
{
table->file->ha_delete_all_rows();
table->file->info(HA_STATUS_VARIABLE);
@ -946,13 +944,13 @@ bool st_select_lex_unit::exec()
Don't add more sum_items if we have already done JOIN::prepare
for this (with a different join object)
*/
if (!fake_select_lex->ref_pointer_array)
if (fake_select_lex->ref_pointer_array.is_null())
fake_select_lex->n_child_sum_items+= global_parameters()->n_sum_items;
if (!was_executed)
save_union_explain_part2(thd->lex->explain);
saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
saved_error= mysql_select(thd,
&result_table_list,
0, item_list, NULL,
global_parameters()->order_list.elements,
@ -975,7 +973,7 @@ bool st_select_lex_unit::exec()
to reset them back, we re-do all of the actions (yes it is ugly):
*/ // psergey-todo: is the above really necessary anymore??
join->init(thd, item_list, fake_select_lex->options, result);
saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
saved_error= mysql_select(thd,
&result_table_list,
0, item_list, NULL,
global_parameters()->order_list.elements,
@ -1022,27 +1020,11 @@ bool st_select_lex_unit::cleanup()
}
cleaned= 1;
if (union_result)
{
delete union_result;
union_result=0; // Safety
if (table)
free_tmp_table(thd, table);
table= 0; // Safety
}
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
error|= sl->cleanup();
if (fake_select_lex)
{
JOIN *join;
if ((join= fake_select_lex->join))
{
join->tables_list= 0;
join->table_count= 0;
join->top_join_tab_count= 0;
}
error|= fake_select_lex->cleanup();
/*
There are two cases when we should clean order items:
@ -1064,6 +1046,15 @@ bool st_select_lex_unit::cleanup()
}
}
if (union_result)
{
delete union_result;
union_result=0; // Safety
if (table)
free_tmp_table(thd, table);
table= 0; // Safety
}
DBUG_RETURN(error);
}