summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-02-08 20:14:13 +0200
committerunknown <bell@sanja.is.com.ua>2004-02-08 20:14:13 +0200
commit541cb675c87ae1efa1e1769abaed03e9535eaf27 (patch)
tree14b2b58964802549177419493c886e1dd62be7e3 /sql/item_subselect.h
parent715e7a63a6f9a1b278c03f13b4580194161b2ed4 (diff)
downloadmariadb-git-541cb675c87ae1efa1e1769abaed03e9535eaf27.tar.gz
fixed subquery with PS (BUG#2462)
fixed UNION preparation sql/item.cc: debug output added sql/item.h: debug output added sql/item_cmpfunc.cc: correct cleunup() for Item_in_optimizer sql/item_cmpfunc.h: correct cleunup() for Item_in_optimizer debug output added sql/item_func.h: debug output added sql/item_subselect.cc: support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup() sql/item_subselect.h: support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup() sql/item_sum.cc: debug output added sql/item_sum.h: debug output added sql/sql_class.cc: function to switch allocation arena for Items sql/sql_class.h: function to switch allocation arena for Items pointer on current prepared statement added sql/sql_lex.cc: comment fixed sql/sql_lex.h: item cleanup support sql/sql_prepare.cc: - fixed preparation of PS to avoid storing junk in its memory + correct work with union - fixed tables cleanup for UNION & subqueries sql/sql_select.cc: removed condition which is always true for now fixed layout sql/sql_union.cc: support of UNION subquery cleanup tests/client_test.c: test of repeatable subqueries test of correct UNION initialisation
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index dc3d07540da..d550cde64b7 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -26,6 +26,7 @@ class JOIN;
class select_subselect;
class subselect_engine;
class Item_bool_func2;
+class Statement;
/* base class for subselects */
@@ -35,22 +36,30 @@ class Item_subselect :public Item_result_field
protected:
/* thread handler, will be assigned in fix_fields only */
THD *thd;
+ /* prepared statement, or 0 */
+ Statement *stmt;
/* substitution instead of subselect in case of optimization */
Item *substitution;
+ /* unit of subquery */
+ st_select_lex_unit *unit;
/* engine that perform execution of subselect (single select or union) */
subselect_engine *engine;
+ /* old engine if engine was changed */
+ subselect_engine *old_engine;
/* cache of used external tables */
table_map used_tables_cache;
/* allowed number of columns (1 for single value subqueries) */
uint max_columns;
/* work with 'substitution' */
bool have_to_be_excluded;
- /* cache of constante state */
+ /* cache of constant state */
bool const_item_cache;
public:
/* changed engine indicator */
bool engine_changed;
+ /* subquery is transformed */
+ bool changed;
enum trans_res {RES_OK, RES_REDUCE, RES_ERROR};
enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
@@ -94,6 +103,7 @@ public:
void print(String *str);
bool change_engine(subselect_engine *eng)
{
+ old_engine= engine;
engine= eng;
engine_changed= 1;
return eng == 0;
@@ -116,6 +126,7 @@ public:
Item_singlerow_subselect(st_select_lex *select_lex);
Item_singlerow_subselect() :Item_subselect(), value(0), row (0) {}
+ void cleanup();
subs_type substype() { return SINGLEROW_SUBS; }
void reset();
@@ -200,13 +211,6 @@ public:
{}
- void cleanup()
- {
- Item_exists_subselect::cleanup();
- abort_on_null= 0;
- transformed= 0;
- upper_not= 0;
- }
subs_type substype() { return IN_SUBS; }
void reset()
{
@@ -269,7 +273,7 @@ public:
maybe_null= 0;
}
virtual ~subselect_engine() {}; // to satisfy compiler
- virtual void cleanup() {}
+ virtual void cleanup()= 0;
// set_thd should be called before prepare()
void set_thd(THD *thd_arg) { thd= thd_arg; }
@@ -318,6 +322,7 @@ public:
subselect_union_engine(st_select_lex_unit *u,
select_subselect *result,
Item_subselect *item);
+ void cleanup();
int prepare();
void fix_length_and_dec(Item_cache** row);
int exec();
@@ -345,6 +350,7 @@ public:
set_thd(thd_arg);
}
~subselect_uniquesubquery_engine();
+ void cleanup();
int prepare();
void fix_length_and_dec(Item_cache** row);
int exec();