summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-12-19 21:15:09 +0200
committerunknown <bell@sanja.is.com.ua>2002-12-19 21:15:09 +0200
commita05b0f087c02eb7165a26e531f5e4cc34db0b173 (patch)
tree79e311ce07c95a3067d23f7bd8f90337175249d1 /sql/item.h
parent900a86f63141bf78b3571518264c5076c3330587 (diff)
downloadmariadb-git-a05b0f087c02eb7165a26e531f5e4cc34db0b173.tar.gz
row IN subselects (SCRUM)
mysql-test/r/subselect.result: test of row IN subslect mysql-test/t/subselect.test: test of row IN subslect sql/item.cc: New helper Item - reference on item list by number cache item for row sql/item.h: layout fixed New helper Item - reference on item list by number cache item for row sql/item_cmpfunc.cc: changed Item_in_optimizer to be able work with row sql/item_cmpfunc.h: changed Item_in_optimizer to be able work with row sql/item_row.cc: Fixed row Item to be compatible with row subselect sql/item_row.h: Fixed row Item to be compatible with row subselect sql/item_subselect.cc: changed name of class to corerectly reflex its function row IN subselect sql/item_subselect.h: changed name of class to corerectly reflex its function row IN subselect sql/sql_class.cc: changed name of class to corerectly reflex its function sql/sql_class.h: changed name of class to corerectly reflex its function sql/sql_yacc.yy: changed name of class to corerectly reflex its function
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h70
1 files changed, 69 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h
index 21087cfe0e2..4e3c5f597ab 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -501,7 +501,7 @@ protected:
Item_in_subselect* owner;
public:
Item_ref_null_helper(Item_in_subselect* master, Item **item,
- char *table_name_par,char *field_name_par):
+ char *table_name_par, char *field_name_par):
Item_ref(item, table_name_par, field_name_par), owner(master) {}
double val();
longlong val_int();
@@ -509,6 +509,24 @@ public:
bool get_date(TIME *ltime, bool fuzzydate);
};
+
+/*
+ Used to find item in list of select items after '*' items processing.
+*/
+class Item_ref_on_list_position: public Item_ref_null_helper
+{
+protected:
+ List<Item> &list;
+ uint pos;
+public:
+ Item_ref_on_list_position(Item_in_subselect* master,
+ List<Item> &li, uint num,
+ char *table_name, char *field_name):
+ Item_ref_null_helper(master, 0, table_name, field_name),
+ list(li), pos(num) {}
+ bool fix_fields(THD *, struct st_table_list *, Item ** ref);
+};
+
/*
To resolve '*' field moved to condition
and register NULL values
@@ -642,6 +660,8 @@ public:
class Item_cache: public Item
{
public:
+ virtual bool allocate(uint i) { return 0; };
+ virtual bool setup(Item *) { return 0; };
virtual void store(Item *)= 0;
void set_len_n_dec(uint32 max_len, uint8 dec)
{
@@ -705,6 +725,54 @@ public:
CHARSET_INFO *charset() const { return value->charset(); };
};
+class Item_cache_row: public Item_cache
+{
+ Item_cache **values;
+ uint n;
+public:
+ Item_cache_row(): values(0), n(2) { fixed= 1; null_value= 1; }
+
+ /*
+ 'allocate' used only in row transformer, to preallocate space for row
+ cache.
+ */
+ bool allocate(uint num);
+ /*
+ 'setup' is needed only by row => it not called by simple row subselect
+ (only by IN subselect (in subselect optimizer))
+ */
+ bool setup(Item *item);
+ void store(Item *item);
+ void illegal_method_call(const char *);
+ void make_field(Send_field *)
+ {
+ illegal_method_call((const char*)"make_field");
+ };
+ double val()
+ {
+ illegal_method_call((const char*)"val");
+ return 0;
+ };
+ longlong val_int()
+ {
+ illegal_method_call((const char*)"val_int");
+ return 0;
+ };
+ String *val_str(String *)
+ {
+ illegal_method_call((const char*)"val_str");
+ return 0;
+ };
+ enum Item_result result_type() const { return ROW_RESULT; }
+
+ uint cols() { return n; }
+ Item* el(uint i) { return values[i]; }
+ Item** addr(uint i) { return (Item **) (values + i); }
+ bool check_cols(uint c);
+ bool null_inside();
+ void bring_value();
+};
+
extern Item_buff *new_Item_buff(Item *item);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern Item *resolve_const_item(Item *item,Item *cmp_item);