diff options
author | unknown <bell@sanja.is.com.ua> | 2003-11-23 02:01:15 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-11-23 02:01:15 +0200 |
commit | 3e21b667bcf164779674e0c08d8c1b9044acc2b5 (patch) | |
tree | e4fd5f08fab614b6e2c048191bd9451abd45131d /sql/item.h | |
parent | 920c30b43a3be8955db4e03cc393dd56ac8f5239 (diff) | |
download | mariadb-git-3e21b667bcf164779674e0c08d8c1b9044acc2b5.tar.gz |
Fixed UNION fields type/length detecting
mysql-test/r/union.result:
new results with max union field length detecting
type conversion tests
mysql-test/t/union.test:
type conversion tests
sql/field.h:
field converion support
sql/item.cc:
fixed printing field of internal temporary table of SELECT (reference from HAVING clause)
layout fix
new item for storing field type
sql/item.h:
new item for storing field type
sql/item_subselect.cc:
new subquery item length/dec detecting
sql/mysql_priv.h:
we do not need pre-inited tables and fields
sql/sql_base.cc:
we do not need double fix_fielding
sql/sql_class.h:
we do not need double fix_fielding
sql/sql_derived.cc:
preparing moved before temporary table creation
sql/sql_lex.h:
we do not need pre-inited tables and fields
new lists to store fields types and fields of temporary table
sql/sql_parse.cc:
we do not need pre-inited tables and fields
sql/sql_prepare.cc:
we do not need pre-inited tables and fields
sql/sql_select.cc:
we do not need pre-inited tables and fields
support mysql_select call from derived tables after it preparing (in derived table routing)
support of crreating temporary table fields from Item_type_holder
sql/sql_select.h:
we do not need pre-inited tables and fields
sql/sql_union.cc:
we do not need pre-inited tables and fields
check of columns number in union moved to prepare()
prepering of SELECTS moved before temporary table creation, fixed union columns type/length detecting
sql/sql_update.cc:
we do not need pre-inited tables and fields
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/sql/item.h b/sql/item.h index 907b9ea5ad4..ceeb2158155 100644 --- a/sql/item.h +++ b/sql/item.h @@ -98,7 +98,7 @@ public: COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_VALUE_ITEM, PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM, - SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM}; + SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER}; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; @@ -371,17 +371,17 @@ class Item_int :public Item public: const longlong value; Item_int(int32 i,uint length=11) :value((longlong) i) - { max_length=length;} + { max_length=length; fixed= 1; } #ifdef HAVE_LONG_LONG Item_int(longlong i,uint length=21) :value(i) - { max_length=length;} + { max_length=length; fixed= 1;} #endif Item_int(const char *str_arg,longlong i,uint length) :value(i) - { max_length=length; name=(char*) str_arg;} + { max_length=length; name=(char*) str_arg; fixed= 1; } Item_int(const char *str_arg) : value(str_arg[0] == '-' ? strtoll(str_arg,(char**) 0,10) : (longlong) strtoull(str_arg,(char**) 0,10)) - { max_length= (uint) strlen(str_arg); name=(char*) str_arg;} + { max_length= (uint) strlen(str_arg); name=(char*) str_arg; fixed= 1; } enum Type type() const { return INT_ITEM; } enum Item_result result_type () const { return INT_RESULT; } enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; } @@ -969,6 +969,28 @@ public: void bring_value(); }; + +/* + Used to store type. name, length of Item for UNIONS & derived table +*/ +class Item_type_holder: public Item +{ +protected: + Item_result item_type; + Field *field_example; +public: + Item_type_holder(THD*, Item*); + + Item_result result_type () const { return item_type; } + enum Type type() const { return TYPE_HOLDER; } + double val(); + longlong val_int(); + String *val_str(String*); + void join_types(THD *thd, Item *); + Field *example() { return field_example; } +}; + + 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); |