diff --git a/sql/item.cc b/sql/item.cc index 5a448ef0e63..eb3e1a15977 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3511,7 +3511,7 @@ Item_param::Item_param(THD *thd, const LEX_CSTRING *name_arg, uint pos_in_query_arg, uint len_in_query_arg): Item_basic_value(thd), Rewritable_query_parameter(pos_in_query_arg, len_in_query_arg), - Type_handler_hybrid_field_type(MYSQL_TYPE_VARCHAR), + Type_handler_hybrid_field_type(&type_handler_varchar), state(NO_VALUE), /* Don't pretend to be a literal unless value for this item is set. */ item_type(PARAM_ITEM), @@ -3793,11 +3793,11 @@ bool Item_param::set_from_item(THD *thd, Item *item) switch (item->cmp_type()) { case REAL_RESULT: set_double(tmp.value.m_double); - set_handler_by_field_type(MYSQL_TYPE_DOUBLE); + set_handler(&type_handler_double); break; case INT_RESULT: set_int(tmp.value.m_longlong, MY_INT64_NUM_DECIMAL_DIGITS); - set_handler_by_field_type(MYSQL_TYPE_LONGLONG); + set_handler(&type_handler_longlong); break; case STRING_RESULT: { @@ -3806,7 +3806,7 @@ bool Item_param::set_from_item(THD *thd, Item *item) Exact value of max_length is not known unless data is converted to charset of connection, so we have to set it later. */ - set_handler_by_field_type(MYSQL_TYPE_VARCHAR); + set_handler(&type_handler_varchar); if (set_str(tmp.m_string.ptr(), tmp.m_string.length())) DBUG_RETURN(1); @@ -3815,7 +3815,7 @@ bool Item_param::set_from_item(THD *thd, Item *item) case DECIMAL_RESULT: { set_decimal(&tmp.m_decimal, unsigned_flag); - set_handler_by_field_type(MYSQL_TYPE_NEWDECIMAL); + set_handler(&type_handler_newdecimal); break; } case TIME_RESULT: diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 63b13be2879..e60037864dc 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1026,7 +1026,7 @@ protected: cache_type_info(items[1], true); // If both arguments are NULL, make resulting type BINARY(0). if (items[1]->type() == NULL_ITEM) - set_handler_by_field_type(MYSQL_TYPE_STRING); + set_handler(&type_handler_string); } else if (items[1]->type() == NULL_ITEM) { diff --git a/sql/item_func.cc b/sql/item_func.cc index 684b5a4f67d..f048baf8b37 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5318,7 +5318,7 @@ void Item_func_get_user_var::fix_length_and_dec() break; case STRING_RESULT: max_length= MAX_BLOB_WIDTH - 1; - set_handler_by_field_type(MYSQL_TYPE_MEDIUM_BLOB); + set_handler(&type_handler_medium_blob); break; case DECIMAL_RESULT: fix_char_length(DECIMAL_MAX_STR_LENGTH); @@ -5334,7 +5334,7 @@ void Item_func_get_user_var::fix_length_and_dec() { collation.set(&my_charset_bin, DERIVATION_IMPLICIT); null_value= 1; - set_handler_by_field_type(MYSQL_TYPE_LONG_BLOB); + set_handler(&type_handler_long_blob); max_length= MAX_BLOB_WIDTH; } } diff --git a/sql/item_sum.h b/sql/item_sum.h index 33ee83f147b..452d8701c62 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1027,7 +1027,7 @@ protected: public: Item_sum_hybrid(THD *thd, Item *item_par,int sign): Item_sum(thd, item_par), - Type_handler_hybrid_field_type(MYSQL_TYPE_LONGLONG), + Type_handler_hybrid_field_type(&type_handler_longlong), value(0), arg_cache(0), cmp(0), cmp_sign(sign), was_values(TRUE) { collation.set(&my_charset_bin); } diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc index 01b591e7919..7117ac69548 100644 --- a/sql/item_windowfunc.cc +++ b/sql/item_windowfunc.cc @@ -243,9 +243,9 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref) Item *item2= args[0]->real_item(); if (item2->type() == Item::FIELD_ITEM) - set_handler_by_field_type(((Item_field*) item2)->field->type()); + set_handler(item2->type_handler()); else if (args[0]->cmp_type() == TIME_RESULT) - set_handler_by_field_type(item2->field_type()); + set_handler(item2->type_handler()); else set_handler_by_result_type(item2->result_type(), max_length, collation.collation); diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 1690d147b26..59b98c93a23 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -285,13 +285,13 @@ class Item_sum_hybrid_simple : public Item_sum, public: Item_sum_hybrid_simple(THD *thd, Item *arg): Item_sum(thd, arg), - Type_handler_hybrid_field_type(MYSQL_TYPE_LONGLONG), + Type_handler_hybrid_field_type(&type_handler_longlong), value(NULL) { collation.set(&my_charset_bin); } Item_sum_hybrid_simple(THD *thd, Item *arg1, Item *arg2): Item_sum(thd, arg1, arg2), - Type_handler_hybrid_field_type(MYSQL_TYPE_LONGLONG), + Type_handler_hybrid_field_type(&type_handler_longlong), value(NULL) { collation.set(&my_charset_bin); } diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 54645a96982..645b88f5daf 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -2241,7 +2241,7 @@ bool Type_handler_numeric:: /* MIN/MAX can return NULL for empty set indepedent of the used column */ func->maybe_null= func->null_value= true; if (item2->type() == Item::FIELD_ITEM) - func->set_handler_by_field_type(item2->field_type()); + func->set_handler(item2->type_handler()); else func->set_handler(handler); return false; @@ -2292,7 +2292,7 @@ bool Type_handler_string_result:: if (item2->type() == Item::FIELD_ITEM) { // Fields: convert ENUM/SET to CHAR, preserve the type otherwise. - func->set_handler_by_field_type(item->field_type()); + func->set_handler(item->type_handler()); } else { diff --git a/sql/sql_type.h b/sql/sql_type.h index c6e62efa8d5..ef145456eb5 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -2259,9 +2259,6 @@ public: Type_handler_hybrid_field_type(const Type_handler *handler) :m_type_handler(handler) { } - Type_handler_hybrid_field_type(enum_field_types type) - :m_type_handler(Type_handler::get_handler_by_field_type(type)) - { } Type_handler_hybrid_field_type(const Type_handler_hybrid_field_type *other) :m_type_handler(other->m_type_handler) { }