summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-01-30 10:16:46 -0700
committerunknown <malff/marcsql@weblab.(none)>2007-01-30 10:16:46 -0700
commit7687a272e44ab9f76fce839fbf2d11281c1d2982 (patch)
tree35222ed06f5971025273f37c1000938f9cd23635 /sql/item_subselect.cc
parent74ac969d572848e98550f0e3c62864a03b5f1951 (diff)
parenta1e20e04d8f91f607a6c498989743f205dafa297 (diff)
downloadmariadb-git-7687a272e44ab9f76fce839fbf2d11281c1d2982.tar.gz
Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into weblab.(none):/home/marcsql/TREE/mysql-5.0-21904 mysql-test/r/subselect.result: Auto merged mysql-test/t/subselect.test: Auto merged sql/item_subselect.cc: Auto merged sql/item_subselect.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index d5d26b7b741..53e1353d308 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -51,6 +51,10 @@ Item_subselect::Item_subselect():
void Item_subselect::init(st_select_lex *select_lex,
select_subselect *result)
{
+ /*
+ Please see Item_singlerow_subselect::invalidate_and_restore_select_lex(),
+ which depends on alterations to the parse tree implemented here.
+ */
DBUG_ENTER("Item_subselect::init");
DBUG_PRINT("enter", ("select_lex: 0x%lx", (long) select_lex));
@@ -91,6 +95,12 @@ void Item_subselect::init(st_select_lex *select_lex,
DBUG_VOID_RETURN;
}
+st_select_lex *
+Item_subselect::get_select_lex()
+{
+ return unit->first_select();
+}
+
void Item_subselect::cleanup()
{
DBUG_ENTER("Item_subselect::cleanup");
@@ -264,6 +274,26 @@ Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
DBUG_VOID_RETURN;
}
+st_select_lex *
+Item_singlerow_subselect::invalidate_and_restore_select_lex()
+{
+ DBUG_ENTER("Item_singlerow_subselect::invalidate_and_restore_select_lex");
+ st_select_lex *result= get_select_lex();
+
+ DBUG_ASSERT(result);
+
+ /*
+ This code restore the parse tree in it's state before the execution of
+ Item_singlerow_subselect::Item_singlerow_subselect(),
+ and in particular decouples this object from the SELECT_LEX,
+ so that the SELECT_LEX can be used with a different flavor
+ or Item_subselect instead, as part of query rewriting.
+ */
+ unit->item= NULL;
+
+ DBUG_RETURN(result);
+}
+
Item_maxmin_subselect::Item_maxmin_subselect(THD *thd_param,
Item_subselect *parent,
st_select_lex *select_lex,