Commit 4e9022b4 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-12718 Determine Item::cmp_type() from Item::type_handler()

parent cc694792
......@@ -1694,7 +1694,7 @@ CALL p1();
bool Item_splocal::check_cols(uint n)
{
DBUG_ASSERT(m_thd->spcont);
if (cmp_type() != ROW_RESULT)
if (Type_handler_hybrid_field_type::cmp_type() != ROW_RESULT)
return Item::check_cols(n);
if (n != this_item()->cols() || n == 1)
......
......@@ -751,7 +751,7 @@ class Item: public Value_source,
return type_handler()->result_type();
}
/* ... while cmp_type() specifies how it should be compared */
virtual Item_result cmp_type() const
Item_result cmp_type() const
{
return type_handler()->cmp_type();
}
......@@ -2232,8 +2232,6 @@ class Item_splocal :public Item_sp_variable,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
uint cols() const { return this_item()->cols(); }
Item* element_index(uint i) { return this_item()->element_index(i); }
Item** addr(uint i) { return this_item()->addr(i); }
......@@ -2833,7 +2831,6 @@ class Item_field_row: public Item_field,
const Type_handler *type_handler() const { return &type_handler_row; }
Item_result result_type() const{ return ROW_RESULT ; }
Item_result cmp_type() const { return ROW_RESULT; }
uint cols() const { return arg_count; }
bool element_index_by_name(uint *idx, const LEX_CSTRING &name) const;
Item* element_index(uint i) { return arg_count ? args[i] : this; }
......@@ -3094,8 +3091,6 @@ class Item_param :public Item_basic_value,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
Item_param(THD *thd, const LEX_CSTRING *name_arg,
uint pos_in_query_arg, uint len_in_query_arg);
......@@ -3913,7 +3908,6 @@ class Item_temporal_literal :public Item_basic_constant
enum Type type() const { return DATE_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
enum Item_result result_type () const { return STRING_RESULT; }
Item_result cmp_type() const { return TIME_RESULT; }
bool check_partition_func_processor(void *int_arg) {return FALSE;}
......@@ -5031,8 +5025,6 @@ class Item_copy :public Item,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
void make_field(THD *thd, Send_field *field) { item->make_field(thd, field); }
table_map used_tables() const { return (table_map) 1L; }
......@@ -5561,8 +5553,6 @@ class Item_cache: public Item_basic_constant,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
virtual void keep_array() {}
virtual void print(String *str, enum_query_type query_type);
......@@ -5685,7 +5675,6 @@ class Item_cache_temporal: public Item_cache_int
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
int save_in_field(Field *field, bool no_conversions);
Item_result cmp_type() const { return TIME_RESULT; }
void store_packed(longlong val_arg, Item *example);
/*
Having a clone_item method tells optimizer that this object
......
......@@ -399,8 +399,6 @@ class Item_hybrid_func: public Item_func,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
Field::geometry_type get_geometry_type() const
{ return Type_geometry_attributes::get_geometry_type(); };
};
......@@ -2298,7 +2296,7 @@ class Item_func_get_user_var :public Item_func_user_var,
void fix_length_and_dec();
Field *create_field_for_create_select(TABLE *table)
{
return cmp_type() == STRING_RESULT ?
return Type_handler_hybrid_field_type::cmp_type() == STRING_RESULT ?
type_handler_long_blob.make_and_init_table_field(&(Item::name),
Record_addr(maybe_null),
*this, table) :
......
......@@ -91,7 +91,6 @@ class Item_row: public Item,
table_map used_tables() const { return used_tables_cache; };
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; }
void update_used_tables()
{
used_tables_and_const_cache_init();
......
......@@ -1177,11 +1177,6 @@ enum Item_result Item_singlerow_subselect::result_type() const
return engine->result_type();
}
enum Item_result Item_singlerow_subselect::cmp_type() const
{
return engine->cmp_type();
}
const Type_handler *Item_singlerow_subselect::type_handler() const
{
return engine->type_handler();
......
......@@ -304,7 +304,6 @@ class Item_singlerow_subselect :public Item_subselect
bool val_bool();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
enum Item_result result_type() const;
enum Item_result cmp_type() const;
const Type_handler *type_handler() const;
void fix_length_and_dec();
......
......@@ -785,8 +785,6 @@ class Item_sum_sum :public Item_sum_num,
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
void reset_field();
......@@ -1052,8 +1050,6 @@ class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
{ return Type_handler_hybrid_field_type::type_handler(); }
enum Item_result result_type () const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type () const
{ return Type_handler_hybrid_field_type::cmp_type(); }
void update_field();
void min_max_update_str_field();
void min_max_update_real_field();
......@@ -1406,7 +1402,6 @@ class Item_sum_udf_float :public Item_udf_sum
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *);
enum Item_result result_type () const { return REAL_RESULT; }
enum Item_result cmp_type () const { return REAL_RESULT; }
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);
......@@ -1644,7 +1639,6 @@ class Item_func_group_concat : public Item_sum
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
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; }
const Type_handler *type_handler() const
{
if (too_big_for_varchar())
......
......@@ -528,7 +528,6 @@ class Item_temporal_func: public Item_func
Item_temporal_func(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {}
Item_temporal_func(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b, c) {}
enum Item_result result_type () const { return STRING_RESULT; }
Item_result cmp_type() const { return TIME_RESULT; }
String *val_str(String *str);
longlong val_int() { return val_int_from_date(); }
double val_real() { return val_real_from_date(); }
......
......@@ -305,8 +305,6 @@ class Item_sum_hybrid_simple : public Item_sum,
String *val_str(String *);
enum Item_result result_type() const
{ return Type_handler_hybrid_field_type::result_type(); }
enum Item_result cmp_type() const
{ return Type_handler_hybrid_field_type::cmp_type(); }
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
void update_field();
......
......@@ -72,7 +72,6 @@ class Item_proc_real :public Item_proc
decimals=dec; max_length=float_length(dec);
}
enum Item_result result_type () const { return REAL_RESULT; }
enum Item_result cmp_type () const { return REAL_RESULT; }
const Type_handler *type_handler() const { return &type_handler_double; }
void set(double nr) { value=nr; }
void set(longlong nr) { value=(double) nr; }
......@@ -100,7 +99,6 @@ class Item_proc_int :public Item_proc
Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par)
{ max_length=11; }
enum Item_result result_type () const { return INT_RESULT; }
enum Item_result cmp_type () const { return INT_RESULT; }
const Type_handler *type_handler() const { return &type_handler_longlong; }
void set(double nr) { value=(longlong) nr; }
void set(longlong nr) { value=nr; }
......@@ -120,7 +118,6 @@ class Item_proc_string :public Item_proc
Item_proc_string(THD *thd, const char *name_par, uint length):
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; }
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()); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment