summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-11-23 02:01:15 +0200
committerunknown <bell@sanja.is.com.ua>2003-11-23 02:01:15 +0200
commit3e21b667bcf164779674e0c08d8c1b9044acc2b5 (patch)
treee4fd5f08fab614b6e2c048191bd9451abd45131d /sql/field.h
parent920c30b43a3be8955db4e03cc393dd56ac8f5239 (diff)
downloadmariadb-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/field.h')
-rw-r--r--sql/field.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 692e64d1146..ef6920f4d89 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -230,6 +230,24 @@ public:
virtual bool has_charset(void) const { return FALSE; }
virtual void set_charset(CHARSET_INFO *charset) { }
void set_warning(const unsigned int level, const unsigned int code);
+ /*
+ number which describe preferences of field type converion,
+ for example, if we have int and float, float is prefered as more general
+
+ ennumiration begins from:
+ 100 for int types
+ 300 for float point
+ 500 time/date
+ 700 string
+ */
+ virtual uint convert_order()= 0;
+ /*
+ Is this type is compatible with given
+ (given can be stored in it)
+ Should take care only of types 'less' then current
+ */
+ virtual bool convert_order_compatible(uint order) { return 0; }
+
friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options,
ulonglong auto_increment_value);
@@ -334,6 +352,7 @@ public:
void overflow(bool negative);
bool zero_pack() const { return 0; }
void sql_type(String &str) const;
+ uint convert_order() { return 130; }
};
@@ -369,6 +388,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 1; }
void sql_type(String &str) const;
+ uint convert_order() { return 100; }
};
@@ -404,6 +424,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 2; }
void sql_type(String &str) const;
+ uint convert_order() { return 101; }
};
@@ -434,6 +455,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 3; }
void sql_type(String &str) const;
+ uint convert_order() { return 102; }
};
@@ -469,6 +491,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
+ uint convert_order() { return 103; }
};
@@ -507,6 +530,7 @@ public:
uint32 pack_length() const { return 8; }
void sql_type(String &str) const;
bool store_for_compare() { return 1; }
+ uint convert_order() { return 104; }
};
#endif
@@ -540,6 +564,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(float); }
void sql_type(String &str) const;
+ uint convert_order() { return 300; }
};
@@ -573,6 +598,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return sizeof(double); }
void sql_type(String &str) const;
+ uint convert_order() { return 301; }
};
@@ -606,6 +632,7 @@ public:
uint32 pack_length() const { return 0; }
void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); }
+ uint convert_order() { return 0; }
};
@@ -649,6 +676,8 @@ public:
}
bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime);
+ uint convert_order() { return 520; }
+ bool convert_order_compatible(uint ord) { return ord<520; }
};
@@ -674,6 +703,8 @@ public:
String *val_str(String*,String *);
bool send_binary(Protocol *protocol);
void sql_type(String &str) const;
+ uint convert_order() { return 501; }
+ bool convert_order_compatible(uint ord) { return ord<520; }
};
@@ -706,6 +737,8 @@ public:
void sql_type(String &str) const;
bool store_for_compare() { return 1; }
bool zero_pack() const { return 1; }
+ uint convert_order() { return 502; }
+ bool convert_order_compatible(uint ord) { return ord<520; }
};
class Field_newdate :public Field_str {
@@ -737,6 +770,8 @@ public:
bool zero_pack() const { return 1; }
bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime);
+ uint convert_order() { return 503; }
+ bool convert_order_compatible(uint ord) { return ord<520; }
};
@@ -770,6 +805,8 @@ public:
void sql_type(String &str) const;
bool store_for_compare() { return 1; }
bool zero_pack() const { return 1; }
+ uint convert_order() { return 504; }
+ bool convert_order_compatible(uint ord) { return ord<520; }
};
@@ -807,6 +844,8 @@ public:
bool zero_pack() const { return 1; }
bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime);
+ uint convert_order() { return 530; }
+ bool convert_order_compatible(uint ord) { return ord<=501; }
};
@@ -851,6 +890,7 @@ public:
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_STRING; }
bool has_charset(void) const { return TRUE; }
+ uint convert_order() { return 700; }
};
@@ -894,6 +934,7 @@ public:
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_VAR_STRING; }
bool has_charset(void) const { return TRUE; }
+ uint convert_order() { return 701; }
};
@@ -983,6 +1024,7 @@ public:
uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
+ uint convert_order() { return 701; }
};
@@ -1011,6 +1053,8 @@ public:
void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type);
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
+ uint convert_order() { return 750; }
+ bool convert_order_compatible(uint ord) { return ord < 750; };
};
@@ -1052,6 +1096,8 @@ public:
bool optimize_range(uint idx) { return 0; }
bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
+ uint convert_order() { return 30; }
+ bool convert_order_compatible(uint ord) { return ord < 30; };
};
@@ -1077,6 +1123,8 @@ public:
void sql_type(String &str) const;
enum_field_types real_type() const { return FIELD_TYPE_SET; }
bool has_charset(void) const { return TRUE; }
+ uint convert_order() { return 40; }
+ bool convert_order_compatible(uint ord) { return ord < 40; };
};