summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2013-11-11 22:47:04 +0200
committerunknown <sanja@montyprogram.com>2013-11-11 22:47:04 +0200
commit3a75900b91ffb4d49396d8f83e0b55b392e83a2a (patch)
treee21a66a326a380ae8d56859ed4f06a16fce20d92 /sql/item_subselect.cc
parent8f0be1ad7c2f13a7fd96889bde3402e9a723fc33 (diff)
parentdfed447888e1ab71ec0c80b61459bde6ee6eaf66 (diff)
downloadmariadb-git-3a75900b91ffb4d49396d8f83e0b55b392e83a2a.tar.gz
merge 5.5->10.0-base
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 6809ee0dfb5..7144289a1de 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -2277,11 +2277,11 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
DBUG_RETURN(true);
Item *item_eq=
new Item_func_eq(new
- Item_ref(&select_lex->context,
- (*optimizer->get_cache())->
- addr(i),
- (char *)"<no matter>",
- (char *)in_left_expr_name),
+ Item_direct_ref(&select_lex->context,
+ (*optimizer->get_cache())->
+ addr(i),
+ (char *)"<no matter>",
+ (char *)in_left_expr_name),
new
Item_ref(&select_lex->context,
select_lex->ref_pointer_array + i,
@@ -3000,7 +3000,7 @@ out:
bool
Item_in_subselect::select_in_like_transformer(JOIN *join)
{
- Query_arena *arena, backup;
+ Query_arena *arena= 0, backup;
SELECT_LEX *current= thd->lex->current_select;
const char *save_where= thd->where;
bool trans_res= true;
@@ -3022,9 +3022,6 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
}
}
- if (changed)
- DBUG_RETURN(false);
-
thd->where= "IN/ALL/ANY subquery";
/*
@@ -3035,25 +3032,29 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
note: we won't need Item_in_optimizer when handling degenerate cases
like "... IN (SELECT 1)"
*/
+ arena= thd->activate_stmt_arena_if_needed(&backup);
if (!optimizer)
{
- arena= thd->activate_stmt_arena_if_needed(&backup);
result= (!(optimizer= new Item_in_optimizer(left_expr, this)));
- if (arena)
- thd->restore_active_arena(arena, &backup);
if (result)
- goto err;
+ goto out;
}
thd->lex->current_select= current->return_after_parsing();
- result= (!left_expr->fixed &&
- left_expr->fix_fields(thd, optimizer->arguments()));
+ result= optimizer->fix_left(thd);
/* fix_fields can change reference to left_expr, we need reassign it */
left_expr= optimizer->arguments()[0];
-
thd->lex->current_select= current;
+
+ if (changed)
+ {
+ trans_res= false;
+ goto out;
+ }
+
+
if (result)
- goto err;
+ goto out;
/*
Both transformers call fix_fields() only for Items created inside them,
@@ -3062,7 +3063,6 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
of Item, we have to call fix_fields() for it only with original arena to
avoid memory leack)
*/
- arena= thd->activate_stmt_arena_if_needed(&backup);
if (left_expr->cols() == 1)
trans_res= single_value_transformer(join);
else
@@ -3077,9 +3077,9 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
}
trans_res= row_value_transformer(join);
}
+out:
if (arena)
thd->restore_active_arena(arena, &backup);
-err:
thd->where= save_where;
DBUG_RETURN(trans_res);
}