summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-05-14 21:51:33 +0300
committerunknown <bell@sanja.is.com.ua>2003-05-14 21:51:33 +0300
commita32b868c3b930b512ffd840c2708e0ee894507b1 (patch)
treedd5bbcb7c0561f00a367fdeab1296efdea9012ca /sql/item_subselect.h
parent79c53934bec3cb6504f8cf8b1c6d8d465b12a149 (diff)
downloadmariadb-git-a32b868c3b930b512ffd840c2708e0ee894507b1.tar.gz
subselect transformation moved in after-fix_field place
removed "of is null" if it is possible (this cset should be SCRUM related, but not approved as scrum task yet) mysql-test/r/subselect.result: new subselect test result (new place of error detecting & and more subselect reducing) sql/item.cc: layout fix sql/item.h: unneed ';' fixed print pethod sql/item_cmpfunc.cc: new method to support transformation after fix_fields sql/item_cmpfunc.h: new method to support transformation after fix_fields fixed Item printing sql/item_subselect.cc: new transformation sql/item_subselect.h: new transformation sql/sql_derived.cc: 'table' & 'table_list' now is not union sql/sql_lex.cc: 'table' & 'table_list' now is not union to support reinit only shared tables (but all) sql/sql_lex.h: mark fake st_select_lex sql/sql_olap.cc: fixed table assignment TODO added sql/sql_select.cc: 'table' & 'table_list' now is not union transforming subselect sql/sql_union.cc: prepare make on fix_fields sql/sql_yacc.yy: fixed layout sql/table.h: 'table & 'table_list' now is different fields
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index fc4dad5a6b3..3e8dd0e02dc 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -46,6 +46,8 @@ protected:
bool have_to_be_excluded;
public:
+ enum trans_res {OK, REDUCE, ERROR};
+
Item_subselect();
Item_subselect(Item_subselect *item)
{
@@ -71,7 +73,7 @@ public:
{
null_value= 1;
}
- virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
+ virtual trans_res select_transformer(THD *thd, JOIN *join);
bool assigned() { return value_assigned; }
void assigned(bool a) { value_assigned= a; }
enum Type type() const;
@@ -83,6 +85,13 @@ public:
bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref);
virtual void fix_length_and_dec();
table_map used_tables() const;
+ void print(String *str)
+ {
+ if (name)
+ str->append(name);
+ else
+ str->append("-subselect-");
+ }
friend class select_subselect;
friend class Item_in_optimizer;
@@ -105,7 +114,7 @@ public:
decimals= item->decimals;
}
void reset();
- void select_transformer(THD *thd, st_select_lex_unit *unit);
+ trans_res select_transformer(THD *thd, JOIN *join);
void store(uint i, Item* item);
double val();
longlong val_int ();
@@ -161,25 +170,35 @@ class Item_in_subselect :public Item_exists_subselect
{
protected:
Item * left_expr;
+ /*
+ expr & optinizer used in subselect rewriting to store Item for
+ all JOIN in UNION
+ */
+ Item *expr;
+ Item_in_optimizer *optimizer;
bool was_null;
+ bool abort_on_null;
public:
Item_in_subselect(THD *thd, Item * left_expr, st_select_lex *select_lex);
Item_in_subselect(Item_in_subselect *item);
- Item_in_subselect(): Item_exists_subselect() {}
+ Item_in_subselect(): Item_exists_subselect(), abort_on_null(0) {}
void reset()
{
value= 0;
null_value= 0;
was_null= 0;
}
- virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
- void single_value_transformer(THD *thd, st_select_lex_unit *unit,
- Item *left_expr, compare_func_creator func);
- void row_value_transformer(THD *thd, st_select_lex_unit *unit,
- Item *left_expr);
+ trans_res select_transformer(THD *thd, JOIN *join);
+ trans_res single_value_transformer(THD *thd, JOIN *join,
+ Item *left_expr,
+ compare_func_creator func);
+ trans_res row_value_transformer(THD *thd, JOIN * join,
+ Item *left_expr);
longlong val_int();
double val();
String *val_str(String*);
+ void top_level_item() { abort_on_null=1; }
+ bool test_limit(st_select_lex_unit *unit);
friend class Item_asterisk_remover;
friend class Item_ref_null_helper;
@@ -196,7 +215,7 @@ public:
Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f,
st_select_lex *select_lex);
Item_allany_subselect(Item_allany_subselect *item);
- virtual void select_transformer(THD *thd, st_select_lex_unit *unit);
+ trans_res select_transformer(THD *thd, JOIN *join);
};
class subselect_engine: public Sql_alloc