1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with the latest 5.3 code.

This commit is contained in:
Igor Babaev
2011-07-17 00:52:07 -07:00
17 changed files with 323 additions and 184 deletions

View File

@ -1604,6 +1604,7 @@ void st_select_lex::init_query()
top_join_list.empty();
join_list= &top_join_list;
embedding= 0;
leaf_tables_prep.empty();
leaf_tables.empty();
item_list.empty();
join= 0;
@ -1646,6 +1647,7 @@ void st_select_lex::init_select()
{
st_select_lex_node::init_select();
sj_nests.empty();
sj_subselects.empty();
group_list.empty();
type= db= 0;
having= 0;
@ -1672,6 +1674,7 @@ void st_select_lex::init_select()
cond_value= having_value= Item::COND_UNDEF;
inner_refs_list.empty();
full_group_by_flag= 0;
is_prep_leaf_list_saved= FALSE;
insert_tables= 0;
merged_into= 0;
}
@ -3233,12 +3236,6 @@ bool st_select_lex::get_free_table_map(table_map *map, uint *tablenr)
*map= 0;
*tablenr= 0;
TABLE_LIST *tl;
if (!join)
{
(*map)= 1<<1;
(*tablenr)++;
return FALSE;
}
List_iterator<TABLE_LIST> ti(leaf_tables);
while ((tl= ti++))
{
@ -3395,7 +3392,8 @@ void st_select_lex::remap_tables(TABLE_LIST *derived, table_map map,
@return FALSE ok
*/
bool SELECT_LEX::merge_subquery(TABLE_LIST *derived, SELECT_LEX *subq_select,
bool SELECT_LEX::merge_subquery(THD *thd, TABLE_LIST *derived,
SELECT_LEX *subq_select,
uint table_no, table_map map)
{
derived->wrap_into_nested_join(subq_select->top_join_list);
@ -3403,19 +3401,17 @@ bool SELECT_LEX::merge_subquery(TABLE_LIST *derived, SELECT_LEX *subq_select,
leaf_tables.concat(&subq_select->leaf_tables);
ftfunc_list->concat(subq_select->ftfunc_list);
if (join)
if (join ||
thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
thd->lex->sql_command == SQLCOM_DELETE_MULTI)
{
Item_in_subselect **in_subq;
Item_in_subselect **in_subq_end;
for (in_subq= subq_select->join->sj_subselects.front(),
in_subq_end= subq_select->join->sj_subselects.back();
in_subq != in_subq_end;
in_subq++)
List_iterator_fast<Item_in_subselect> li(subq_select->sj_subselects);
Item_in_subselect *in_subq;
while ((in_subq= li++))
{
join->sj_subselects.append(join->thd->mem_root, *in_subq);
DBUG_ASSERT((*in_subq)->emb_on_expr_nest != NULL);
if ((*in_subq)->emb_on_expr_nest == NO_JOIN_NEST)
(*in_subq)->emb_on_expr_nest= derived;
sj_subselects.push_back(in_subq);
if (in_subq->emb_on_expr_nest == NO_JOIN_NEST)
in_subq->emb_on_expr_nest= derived;
}
}
/*
@ -3628,6 +3624,7 @@ void SELECT_LEX::mark_const_derived(bool empty)
}
}
bool st_select_lex::save_leaf_tables(THD *thd)
{
Query_arena *arena= thd->stmt_arena, backup;
@ -3652,6 +3649,33 @@ bool st_select_lex::save_leaf_tables(THD *thd)
}
bool st_select_lex::save_prep_leaf_tables(THD *thd)
{
if (!thd->save_prep_leaf_list)
return 0;
Query_arena *arena= thd->stmt_arena, backup;
if (arena->is_conventional())
arena= 0;
else
thd->set_n_backup_active_arena(arena, &backup);
List_iterator_fast<TABLE_LIST> li(leaf_tables);
TABLE_LIST *table;
while ((table= li++))
{
if (leaf_tables_prep.push_back(table))
return 1;
}
thd->lex->select_lex.is_prep_leaf_list_saved= TRUE;
thd->save_prep_leaf_list= FALSE;
if (arena)
thd->restore_active_arena(arena, &backup);
return 0;
}
/**
A routine used by the parser to decide whether we are specifying a full
partitioning or if only partitions to add or to split.