summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-05-07 23:06:11 +0300
committerunknown <bell@sanja.is.com.ua>2004-05-07 23:06:11 +0300
commite54ca13b666b48226b7a54d6847d6437ac32ae74 (patch)
tree52e47dc7ee99268a0b704b1402fdd7b965199c80 /sql/sql_union.cc
parentc207325aaf0cbb3781d72891c9ae95e18c6ea355 (diff)
downloadmariadb-git-e54ca13b666b48226b7a54d6847d6437ac32ae74.tar.gz
keep old engine & JOIN if we changed subquery Item (Bug #3646)
mysql-test/r/subselect.result: ALL/ANY test mysql-test/t/subselect.test: ALL/ANY test sql/item_subselect.cc: keep old engine & JOIN if we changed subquery Item, which allow avoid second all SELECT items fix_fields call with pervios clean up (because of second setup_tables which remove table->key_use and maybe something else) keep list when we change Item in SELECT list processing inserted max/min function (now JOIN::prepare will be called only once) methods of changing item for subselect engines sql/item_subselect.h: change item & results procedure sql/item_sum.cc: Item_sum_hybrid::clear moved to .cc file (to keep .h clean and to make inserving/removing debug info easy) sql/item_sum.h: Item_sum_hybrid::clear moved to .cc file (to keep .h clean and to make inserving/removing debug info easy) sql/sql_lex.cc: note about new method sql/sql_lex.h: method for changing result of UNION JOINs sql/sql_select.cc: method for changing result in JOIN sql/sql_select.h: method for changing result in JOIN sql/sql_union.cc: method for changing result in JOIN
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 63638b618d9..de3eeec0db0 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -555,3 +555,32 @@ void st_select_lex_unit::reinit_exec_mechanism()
}
#endif
}
+
+
+/*
+ change select_result object of unit
+
+ SYNOPSIS
+ st_select_lex_unit::change_result()
+ result new select_result object
+ old_result old select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int st_select_lex_unit::change_result(select_subselect *result,
+ select_subselect *old_result)
+{
+ int res= 0;
+ for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
+ {
+ if (sl->join && sl->join->result == old_result)
+ if ((res= sl->join->change_result(result)))
+ return (res);
+ }
+ if (fake_select_lex && fake_select_lex->join)
+ res= fake_select_lex->join->change_result(result);
+ return (res);
+}