mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-12714 Determine Item::field_type() from Item::type_handler()
This commit is contained in:
@@ -6071,7 +6071,7 @@ void Item::make_field(THD *thd, Send_field *tmp_field)
|
||||
|
||||
void Item_empty_string::make_field(THD *thd, Send_field *tmp_field)
|
||||
{
|
||||
init_make_field(tmp_field, string_field_type());
|
||||
init_make_field(tmp_field, string_type_handler()->field_type());
|
||||
}
|
||||
|
||||
|
||||
|
||||
52
sql/item.h
52
sql/item.h
@@ -728,7 +728,10 @@ public:
|
||||
return type_handler()->Item_send(this, protocol, buffer);
|
||||
}
|
||||
virtual bool eq(const Item *, bool binary_cmp) const;
|
||||
virtual enum_field_types field_type() const= 0;
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return type_handler()->field_type();
|
||||
}
|
||||
virtual const Type_handler *type_handler() const= 0;
|
||||
const Type_handler *type_handler_for_comparison() const
|
||||
{
|
||||
@@ -752,10 +755,6 @@ public:
|
||||
{
|
||||
return type_handler()->cmp_type();
|
||||
}
|
||||
enum_field_types string_field_type() const
|
||||
{
|
||||
return Type_handler::string_type_handler(max_length)->field_type();
|
||||
}
|
||||
const Type_handler *string_type_handler() const
|
||||
{
|
||||
return Type_handler::string_type_handler(max_length);
|
||||
@@ -2231,8 +2230,6 @@ public:
|
||||
inline enum Type type() const;
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -2395,7 +2392,6 @@ public:
|
||||
|
||||
inline enum Type type() const;
|
||||
inline Item_result result_type() const;
|
||||
enum_field_types field_type() const { return this_item()->field_type(); }
|
||||
const Type_handler *type_handler() const { return this_item()->type_handler(); }
|
||||
|
||||
public:
|
||||
@@ -2463,11 +2459,6 @@ public:
|
||||
return value_item->type_handler();
|
||||
}
|
||||
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return value_item->field_type();
|
||||
}
|
||||
|
||||
Item_result result_type() const
|
||||
{
|
||||
return value_item->result_type();
|
||||
@@ -2623,7 +2614,6 @@ public:
|
||||
String *val_str(String *str) { return field->val_str(str); }
|
||||
my_decimal *val_decimal(my_decimal *dec) { return field->val_decimal(dec); }
|
||||
void make_field(THD *thd, Send_field *tmp_field);
|
||||
enum_field_types field_type() const { return field->type(); }
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
const Type_handler *handler= field->type_handler();
|
||||
@@ -2703,10 +2693,6 @@ public:
|
||||
{
|
||||
return field->type_handler()->cast_to_int_type_handler();
|
||||
}
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return field->type();
|
||||
}
|
||||
const Type_handler *real_type_handler() const
|
||||
{
|
||||
if (field->is_created_from_null_item)
|
||||
@@ -2927,7 +2913,6 @@ public:
|
||||
int save_safe_in_field(Field *field);
|
||||
bool send(Protocol *protocol, st_value *buffer);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NULL; }
|
||||
const Type_handler *type_handler() const { return &type_handler_null; }
|
||||
bool basic_const_item() const { return 1; }
|
||||
Item *clone_item(THD *thd);
|
||||
@@ -3107,8 +3092,6 @@ public:
|
||||
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -3248,10 +3231,6 @@ public:
|
||||
Item_int(THD *thd, const char *str_arg, uint length=64);
|
||||
enum Type type() const { return INT_ITEM; }
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return Item_int::type_handler()->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
// The same condition is repeated in Item::create_tmp_field()
|
||||
@@ -3344,7 +3323,6 @@ public:
|
||||
|
||||
enum Type type() const { return DECIMAL_ITEM; }
|
||||
enum Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
|
||||
longlong val_int();
|
||||
double val_real();
|
||||
@@ -3386,7 +3364,6 @@ public:
|
||||
}
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
enum Type type() const { return REAL_ITEM; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return value; }
|
||||
longlong val_int()
|
||||
@@ -3527,7 +3504,6 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
const Type_handler *type_handler() const { return &type_handler_varchar; }
|
||||
bool basic_const_item() const { return 1; }
|
||||
bool eq(const Item *item, bool binary_cmp) const
|
||||
@@ -3713,10 +3689,9 @@ public:
|
||||
Item_partition_func_safe_string(thd, name_arg, length_arg, &my_charset_bin),
|
||||
date_time_field_type(field_type_arg)
|
||||
{ decimals= 0; }
|
||||
enum_field_types field_type() const { return date_time_field_type; }
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return Type_handler::get_handler_by_field_type(field_type());
|
||||
return Type_handler::get_handler_by_field_type(date_time_field_type);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3728,10 +3703,6 @@ public:
|
||||
Item_partition_func_safe_string(thd, name_arg, safe_strlen(name_arg), &my_charset_bin)
|
||||
{ max_length= length; }
|
||||
enum Type type() const { return TYPE_HOLDER; }
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return Item_blob::type_handler()->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return Type_handler::blob_type_handler(max_length);
|
||||
@@ -3779,7 +3750,6 @@ public:
|
||||
{
|
||||
unsigned_flag=1;
|
||||
}
|
||||
enum_field_types field_type() const { return int_field_type; }
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return Type_handler::get_handler_by_field_type(int_field_type);
|
||||
@@ -3806,7 +3776,6 @@ public:
|
||||
}
|
||||
enum Type type() const { return VARBIN_ITEM; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
const Type_handler *type_handler() const { return &type_handler_varchar; }
|
||||
virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
|
||||
{
|
||||
@@ -3984,7 +3953,6 @@ public:
|
||||
*/
|
||||
maybe_null= !ltime->month || !ltime->day;
|
||||
}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdate; }
|
||||
void print(String *str, enum_query_type query_type);
|
||||
Item *clone_item(THD *thd);
|
||||
@@ -4006,7 +3974,6 @@ public:
|
||||
max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0);
|
||||
fixed= 1;
|
||||
}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_time2; }
|
||||
void print(String *str, enum_query_type query_type);
|
||||
Item *clone_item(THD *thd);
|
||||
@@ -4030,7 +3997,6 @@ public:
|
||||
// See the comment on maybe_null in Item_date_literal
|
||||
maybe_null= !ltime->month || !ltime->day;
|
||||
}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_datetime2; }
|
||||
void print(String *str, enum_query_type query_type);
|
||||
Item *clone_item(THD *thd);
|
||||
@@ -4346,7 +4312,6 @@ public:
|
||||
fast_field_copier setup_fast_field_copier(Field *field)
|
||||
{ return (*ref)->setup_fast_field_copier(field); }
|
||||
enum Item_result result_type () const { return (*ref)->result_type(); }
|
||||
enum_field_types field_type() const { return (*ref)->field_type(); }
|
||||
const Type_handler *type_handler() const { return (*ref)->type_handler(); }
|
||||
const Type_handler *real_type_handler() const
|
||||
{ return (*ref)->real_type_handler(); }
|
||||
@@ -4645,7 +4610,6 @@ public:
|
||||
int save_in_field(Field *to, bool no_conversions);
|
||||
const Type_handler *type_handler() const { return orig_item->type_handler(); }
|
||||
enum Item_result result_type () const { return orig_item->result_type(); }
|
||||
enum_field_types field_type() const { return orig_item->field_type(); }
|
||||
table_map used_tables() const { return orig_item->used_tables(); }
|
||||
void update_used_tables()
|
||||
{
|
||||
@@ -5065,8 +5029,6 @@ public:
|
||||
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -5597,8 +5559,6 @@ public:
|
||||
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -5929,8 +5889,6 @@ public:
|
||||
const Type_handler *handler= Type_handler_hybrid_field_type::type_handler();
|
||||
return handler->type_handler_for_item_field();
|
||||
}
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -2082,7 +2082,7 @@ longlong Item_func_between::val_int_cmp_temporal()
|
||||
bool value_is_null, a_is_null, b_is_null;
|
||||
|
||||
ptr= &args[0];
|
||||
enum_field_types f_type= m_comparator.field_type();
|
||||
enum_field_types f_type= m_comparator.type_handler()->field_type();
|
||||
value= get_datetime_value(thd, &ptr, &cache, f_type, &value_is_null);
|
||||
if (ptr != &args[0])
|
||||
thd->change_item_tree(&args[0], *ptr);
|
||||
|
||||
@@ -6450,14 +6450,6 @@ Item_func_sp::make_field(THD *thd, Send_field *tmp_field)
|
||||
}
|
||||
|
||||
|
||||
enum enum_field_types
|
||||
Item_func_sp::field_type() const
|
||||
{
|
||||
DBUG_ENTER("Item_func_sp::field_type");
|
||||
DBUG_ASSERT(sp_result_field);
|
||||
DBUG_RETURN(sp_result_field->type());
|
||||
}
|
||||
|
||||
const Type_handler *Item_func_sp::type_handler() const
|
||||
{
|
||||
DBUG_ENTER("Item_func_sp::type_handler");
|
||||
|
||||
@@ -371,7 +371,6 @@ public:
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return (longlong) rint(val_real()); }
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void fix_length_and_dec()
|
||||
{ decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
|
||||
@@ -398,8 +397,6 @@ public:
|
||||
:Item_func(thd, item), Type_handler_hybrid_field_type(item) { }
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -737,7 +734,6 @@ public:
|
||||
double val_real();
|
||||
String *val_str(String*str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec() {}
|
||||
};
|
||||
@@ -910,7 +906,6 @@ public:
|
||||
longlong val_int();
|
||||
my_decimal *val_decimal(my_decimal*);
|
||||
enum Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
|
||||
void fix_length_and_dec_generic() {}
|
||||
void fix_length_and_dec()
|
||||
@@ -1547,7 +1542,6 @@ public:
|
||||
const char *func_name() const { return "rollup_const"; }
|
||||
bool const_item() const { return 0; }
|
||||
Item_result result_type() const { return args[0]->result_type(); }
|
||||
enum_field_types field_type() const { return args[0]->field_type(); }
|
||||
const Type_handler *type_handler() const { return args[0]->type_handler(); }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -1955,7 +1949,6 @@ class Item_func_udf_float :public Item_udf_func
|
||||
}
|
||||
double val_real();
|
||||
String *val_str(String *str);
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -1975,7 +1968,6 @@ public:
|
||||
double val_real() { return (double) Item_func_udf_int::val_int(); }
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec() { decimals= 0; max_length= 21; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -1995,7 +1987,6 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -2036,7 +2027,6 @@ public:
|
||||
return dec_buf;
|
||||
}
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return string_field_type(); }
|
||||
const Type_handler *type_handler() const { return string_type_handler(); }
|
||||
void fix_length_and_dec();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -2368,7 +2358,6 @@ public:
|
||||
void load_data_set_null_value(CHARSET_INFO* cs);
|
||||
void load_data_set_value(const char *str, uint length, CHARSET_INFO* cs);
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_user_var_as_out_param>(thd, mem_root, this); }
|
||||
};
|
||||
@@ -2404,10 +2393,6 @@ public:
|
||||
bool const_item() const { return true; }
|
||||
table_map used_tables() const { return 0; }
|
||||
enum Item_result result_type() const;
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return Item_func_get_system_var::type_handler()->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const;
|
||||
double val_real();
|
||||
longlong val_int();
|
||||
@@ -2668,8 +2653,6 @@ public:
|
||||
|
||||
const char *func_name() const;
|
||||
|
||||
enum enum_field_types field_type() const;
|
||||
|
||||
const Type_handler *type_handler() const;
|
||||
|
||||
Field *create_field_for_create_select(TABLE *table)
|
||||
@@ -2856,7 +2839,6 @@ public:
|
||||
enum Item_result result_type () const { return last_value->result_type(); }
|
||||
const char *func_name() const { return "last_value"; }
|
||||
table_map not_null_tables() const { return 0; }
|
||||
enum_field_types field_type() const { return last_value->field_type(); }
|
||||
const Type_handler *type_handler() const { return last_value->type_handler(); }
|
||||
bool const_item() const { return 0; }
|
||||
void evaluate_sideeffects();
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
Item_str_func(thd, a, b, c) {}
|
||||
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
|
||||
void fix_length_and_dec();
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
|
||||
const Type_handler *type_handler() const { return &type_handler_geometry; }
|
||||
};
|
||||
|
||||
@@ -101,7 +100,6 @@ public:
|
||||
Item_func_as_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
const char *func_name() const { return "st_aswkb"; }
|
||||
String *val_str(String *);
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONG_BLOB; }
|
||||
const Type_handler *type_handler() const { return &type_handler_long_blob; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_as_wkb>(thd, mem_root, this); }
|
||||
|
||||
@@ -92,11 +92,6 @@ public:
|
||||
bool const_item() const { return const_item_cache; };
|
||||
enum Item_result result_type() const { return ROW_RESULT; }
|
||||
Item_result cmp_type() const { return ROW_RESULT; }
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return MYSQL_TYPE_DOUBLE;
|
||||
}
|
||||
void update_used_tables()
|
||||
{
|
||||
used_tables_and_const_cache_init();
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
double val_real();
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return string_field_type(); }
|
||||
const Type_handler *type_handler() const { return string_type_handler(); }
|
||||
void left_right_max_length();
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
|
||||
@@ -1187,15 +1187,6 @@ const Type_handler *Item_singlerow_subselect::type_handler() const
|
||||
return engine->type_handler();
|
||||
}
|
||||
|
||||
/*
|
||||
Don't rely on the result type to calculate field type.
|
||||
Ask the engine instead.
|
||||
*/
|
||||
enum_field_types Item_singlerow_subselect::field_type() const
|
||||
{
|
||||
return engine->field_type();
|
||||
}
|
||||
|
||||
void Item_singlerow_subselect::fix_length_and_dec()
|
||||
{
|
||||
if ((max_columns= engine->cols()) == 1)
|
||||
|
||||
@@ -305,7 +305,6 @@ public:
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
|
||||
enum Item_result result_type() const;
|
||||
enum Item_result cmp_type() const;
|
||||
enum_field_types field_type() const;
|
||||
const Type_handler *type_handler() const;
|
||||
void fix_length_and_dec();
|
||||
|
||||
@@ -397,7 +396,6 @@ public:
|
||||
void no_rows_in_result();
|
||||
|
||||
enum Item_result result_type() const { return INT_RESULT;}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
longlong val_int();
|
||||
double val_real();
|
||||
|
||||
@@ -749,7 +749,6 @@ public:
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec()
|
||||
{ decimals=0; max_length=21; maybe_null=null_value=0; }
|
||||
@@ -784,8 +783,6 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
enum Item_result result_type () const
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
@@ -982,7 +979,6 @@ public:
|
||||
Item *copy_or_same(THD* thd);
|
||||
Field *create_tmp_field(bool group, TABLE *table);
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;}
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void cleanup()
|
||||
{
|
||||
@@ -1058,8 +1054,6 @@ protected:
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type () const
|
||||
{ return Type_handler_hybrid_field_type::cmp_type(); }
|
||||
enum enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
void update_field();
|
||||
void min_max_update_str_field();
|
||||
void min_max_update_real_field();
|
||||
@@ -1265,7 +1259,6 @@ public:
|
||||
Item_avg_field_double(THD *thd, Item_sum_avg *item)
|
||||
:Item_avg_field(thd, item)
|
||||
{ }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
longlong val_int() { return val_int_from_real(); }
|
||||
@@ -1287,7 +1280,6 @@ public:
|
||||
f_scale(item->f_scale),
|
||||
dec_bin_size(item->dec_bin_size)
|
||||
{ }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
enum Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
|
||||
double val_real() { return val_real_from_decimal(); }
|
||||
@@ -1314,7 +1306,6 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *dec_buf)
|
||||
{ return val_decimal_from_real(dec_buf); }
|
||||
bool is_null() { update_null_value(); return null_value; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -1416,7 +1407,6 @@ class Item_sum_udf_float :public Item_udf_sum
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum Item_result cmp_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
Item *copy_or_same(THD* thd);
|
||||
@@ -1440,7 +1430,6 @@ public:
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=21; }
|
||||
Item *copy_or_same(THD* thd);
|
||||
@@ -1483,7 +1472,6 @@ public:
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *dec);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return string_field_type(); }
|
||||
const Type_handler *type_handler() const { return string_type_handler(); }
|
||||
void fix_length_and_dec();
|
||||
Item *copy_or_same(THD* thd);
|
||||
@@ -1506,7 +1494,6 @@ public:
|
||||
longlong val_int();
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
enum Item_result result_type () const { return DECIMAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdecimal; }
|
||||
void fix_length_and_dec() { fix_num_length_and_dec(); }
|
||||
Item *copy_or_same(THD* thd);
|
||||
@@ -1658,10 +1645,6 @@ public:
|
||||
const char *func_name() const { return "group_concat("; }
|
||||
virtual Item_result result_type () const { return STRING_RESULT; }
|
||||
virtual Item_result cmp_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return Item_func_group_concat::type_handler()->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
if (too_big_for_varchar())
|
||||
|
||||
@@ -156,7 +156,6 @@ public:
|
||||
}
|
||||
const char *func_name() const { return "month"; }
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -407,7 +406,6 @@ public:
|
||||
return (odbc_type ? "dayofweek" : "weekday");
|
||||
}
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -433,7 +431,6 @@ class Item_func_dayname :public Item_func_weekday
|
||||
const char *func_name() const { return "dayname"; }
|
||||
String *val_str(String *str);
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
const Type_handler *type_handler() const { return &type_handler_varchar; }
|
||||
void fix_length_and_dec();
|
||||
bool check_partition_func_processor(void *int_arg) {return TRUE;}
|
||||
@@ -588,7 +585,6 @@ public:
|
||||
Item_datefunc(THD *thd): Item_temporal_func(thd) { }
|
||||
Item_datefunc(THD *thd, Item *a): Item_temporal_func(thd, a) { }
|
||||
Item_datefunc(THD *thd, Item *a, Item *b): Item_temporal_func(thd, a, b) { }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdate; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -606,7 +602,6 @@ public:
|
||||
Item_timefunc(THD *thd, Item *a, Item *b): Item_temporal_func(thd, a, b) {}
|
||||
Item_timefunc(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_temporal_func(thd, a, b ,c) {}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_time2; }
|
||||
};
|
||||
|
||||
@@ -618,7 +613,6 @@ public:
|
||||
Item_datetimefunc(THD *thd, Item *a): Item_temporal_func(thd, a) {}
|
||||
Item_datetimefunc(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_temporal_func(thd, a, b ,c) {}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_datetime2; }
|
||||
};
|
||||
|
||||
@@ -943,10 +937,6 @@ class Item_extract :public Item_int_func
|
||||
const interval_type int_type; // keep it public
|
||||
Item_extract(THD *thd, interval_type type_arg, Item *a):
|
||||
Item_int_func(thd, a), int_type(type_arg) {}
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return Item_extract::type_handler()->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
switch (int_type) {
|
||||
@@ -1083,7 +1073,6 @@ public:
|
||||
const char *func_name() const { return "cast_as_date"; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
const char *cast_type() const { return "date"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_newdate; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -1102,7 +1091,6 @@ public:
|
||||
const char *func_name() const { return "cast_as_time"; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
const char *cast_type() const { return "time"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_time2; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
@@ -1120,7 +1108,6 @@ public:
|
||||
Item_temporal_typecast(thd, a) { decimals= dec_arg; }
|
||||
const char *func_name() const { return "cast_as_datetime"; }
|
||||
const char *cast_type() const { return "datetime"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
const Type_handler *type_handler() const { return &type_handler_datetime2; }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date);
|
||||
void fix_length_and_dec()
|
||||
|
||||
@@ -307,8 +307,6 @@ class Item_sum_hybrid_simple : public Item_sum,
|
||||
{ return Type_handler_hybrid_field_type::result_type(); }
|
||||
enum Item_result cmp_type() const
|
||||
{ return Type_handler_hybrid_field_type::cmp_type(); }
|
||||
enum enum_field_types field_type() const
|
||||
{ return Type_handler_hybrid_field_type::field_type(); }
|
||||
const Type_handler *type_handler() const
|
||||
{ return Type_handler_hybrid_field_type::type_handler(); }
|
||||
void update_field();
|
||||
@@ -514,7 +512,6 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
|
||||
}
|
||||
bool add();
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
|
||||
void fix_length_and_dec()
|
||||
@@ -601,7 +598,6 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
|
||||
|
||||
void update_field() {}
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
|
||||
void fix_length_and_dec()
|
||||
@@ -679,7 +675,6 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
|
||||
void update_field() {}
|
||||
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
@@ -805,10 +800,6 @@ public:
|
||||
*/
|
||||
void setup_partition_border_check(THD *thd);
|
||||
|
||||
enum_field_types field_type() const
|
||||
{
|
||||
return ((Item_sum *) args[0])->field_type();
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return ((Item_sum *) args[0])->type_handler();
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
virtual void set(double nr)=0;
|
||||
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
|
||||
virtual void set(longlong nr)=0;
|
||||
virtual enum_field_types field_type() const=0;
|
||||
const Type_handler *type_handler() const=0;
|
||||
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
|
||||
void make_field(THD *thd, Send_field *tmp_field)
|
||||
@@ -74,7 +73,6 @@ public:
|
||||
}
|
||||
enum Item_result result_type () const { return REAL_RESULT; }
|
||||
enum Item_result cmp_type () const { return REAL_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
void set(double nr) { value=nr; }
|
||||
void set(longlong nr) { value=(double) nr; }
|
||||
@@ -103,7 +101,6 @@ public:
|
||||
{ max_length=11; }
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
void set(double nr) { value=(longlong) nr; }
|
||||
void set(longlong nr) { value=nr; }
|
||||
@@ -124,7 +121,6 @@ public:
|
||||
Item_proc(thd, name_par) { this->max_length=length; }
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum Item_result cmp_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
const Type_handler *type_handler() const { return &type_handler_varchar; }
|
||||
void set(double nr) { str_value.set_real(nr, 2, default_charset()); }
|
||||
void set(longlong nr) { str_value.set(nr, default_charset()); }
|
||||
|
||||
@@ -670,7 +670,7 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const Type_handler *h)
|
||||
to print DATE constants using proper format:
|
||||
'YYYY-MM-DD' rather than 'YYYY-MM-DD 00:00:00'.
|
||||
*/
|
||||
if (field_type() != h->field_type())
|
||||
if (m_type_handler->field_type() != h->field_type())
|
||||
m_type_handler= &type_handler_datetime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2263,7 +2263,6 @@ public:
|
||||
:m_type_handler(other->m_type_handler)
|
||||
{ }
|
||||
const Type_handler *type_handler() const { return m_type_handler; }
|
||||
enum_field_types field_type() const { return m_type_handler->field_type(); }
|
||||
enum_field_types real_field_type() const
|
||||
{
|
||||
return m_type_handler->real_field_type();
|
||||
|
||||
Reference in New Issue
Block a user