diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-05-01 08:47:04 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-05-01 08:47:04 +0400 |
commit | ea679c88c323dc2c79d9b5c05d4dba9671ad62bc (patch) | |
tree | 9e53fef1a242ecc8c992fb8c94e63debdfbf34ce | |
parent | 0cbc9306163d3bac3d7f69d1f3f44f620c7af859 (diff) | |
download | mariadb-git-ea679c88c323dc2c79d9b5c05d4dba9671ad62bc.tar.gz |
MDEV-19377 Replace Virtual_column_info::field_type to Type_handler
-rw-r--r-- | sql/field.cc | 2 | ||||
-rw-r--r-- | sql/field.h | 17 | ||||
-rw-r--r-- | sql/item.h | 2 |
3 files changed, 9 insertions, 12 deletions
diff --git a/sql/field.cc b/sql/field.cc index 1056a99a498..0de5c377703 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10572,7 +10572,7 @@ bool Column_definition::check(THD *thd) if (vcol_info) { DBUG_ASSERT(vcol_info->expr); - vcol_info->set_field_type(real_field_type()); + vcol_info->set_handler(type_handler()); if (check_expression(vcol_info, &field_name, vcol_info->stored_in_db ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL)) DBUG_RETURN(TRUE); diff --git a/sql/field.h b/sql/field.h index a1fae26dfcc..676c85abbef 100644 --- a/sql/field.h +++ b/sql/field.h @@ -524,7 +524,8 @@ static inline const char *vcol_type_name(enum_vcol_info_type type) - whether the field is used in a partitioning expression */ -class Virtual_column_info: public Sql_alloc +class Virtual_column_info: public Sql_alloc, + private Type_handler_hybrid_field_type { private: enum_vcol_info_type vcol_type; /* Virtual column expression type */ @@ -532,7 +533,6 @@ private: The following data is only updated by the parser and read when a Create_field object is created/initialized. */ - enum_field_types field_type; /* Real field type*/ /* Flag indicating that the field used in a partitioning expression */ bool in_partitioning_expr; @@ -546,8 +546,8 @@ public: uint flags; Virtual_column_info() - : vcol_type((enum_vcol_info_type)VCOL_TYPE_NONE), - field_type((enum enum_field_types)MYSQL_TYPE_VIRTUAL), + :Type_handler_hybrid_field_type(&type_handler_null), + vcol_type((enum_vcol_info_type)VCOL_TYPE_NONE), in_partitioning_expr(FALSE), stored_in_db(FALSE), utf8(TRUE), expr(NULL), flags(0) { @@ -568,14 +568,11 @@ public: DBUG_ASSERT(vcol_type != VCOL_TYPE_NONE); return vcol_type_name(vcol_type); } - enum_field_types get_real_type() const - { - return field_type; - } - void set_field_type(enum_field_types fld_type) + void set_handler(const Type_handler *handler) { /* Calling this function can only be done once. */ - field_type= fld_type; + DBUG_ASSERT(type_handler() == &type_handler_null); + Type_handler_hybrid_field_type::set_handler(handler); } bool is_stored() const { diff --git a/sql/item.h b/sql/item.h index d88216141ce..b2f66b5292c 100644 --- a/sql/item.h +++ b/sql/item.h @@ -7130,7 +7130,7 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, inline bool Virtual_column_info::is_equal(const Virtual_column_info* vcol) const { - return field_type == vcol->get_real_type() + return type_handler() == vcol->type_handler() && stored_in_db == vcol->is_stored() && expr->eq(vcol->expr, true); } |