diff options
author | Galina Shalygina <galashalygina@gmail.com> | 2016-05-08 23:04:41 +0300 |
---|---|---|
committer | Galina Shalygina <galashalygina@gmail.com> | 2016-05-08 23:04:41 +0300 |
commit | be1d06c8a5f843e775374e5ec148aaee56970bdc (patch) | |
tree | bd7a95e771ca3b405583dccab8b468dd6fb4509f /sql/sql_union.cc | |
parent | e09b1f2a226bf2763b211f74908a6486b83ebed1 (diff) | |
download | mariadb-git-be1d06c8a5f843e775374e5ec148aaee56970bdc.tar.gz |
Merge branch '10.2' into 10.2-mdev9864
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 5685c90850a..87b836f40d9 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -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); } |