diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-12-03 23:59:47 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-12-03 23:59:47 +0400 |
commit | 10408782335b3578fbbbfa3645a1be781e0867d7 (patch) | |
tree | f27f120edcdf0d24cf1d5ab9084ca8fec5fe580e /sql/item.h | |
parent | 192c748c246284e199b6a697f4d1e1adf00cf39d (diff) | |
download | mariadb-git-10408782335b3578fbbbfa3645a1be781e0867d7.tar.gz |
MDEV-9215 Detect cmp_type() and result_type() from field_type()
Part8: Derive Item_copy from Type_handler_hybrid_field_type
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sql/item.h b/sql/item.h index e594f40bbd0..64410f33cd7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4539,26 +4539,21 @@ public: from Item_). */ -class Item_copy :public Item +class Item_copy :public Item, + public Type_handler_hybrid_field_type { protected: /** - Stores the type of the resulting field that would be used to store the data + Type_handler_hybrid_field_type is used to + store the type of the resulting field that would be used to store the data in the cache. This is to avoid calls to the original item. */ - enum enum_field_types cached_field_type; /** The original item that is copied */ Item *item; /** - Stores the result type of the original item, so it can be returned - without calling the original item's method - */ - Item_result cached_result_type; - - /** Constructor of the Item_copy class stores metadata information about the original class as well as a @@ -4570,8 +4565,7 @@ protected: null_value=maybe_null=item->maybe_null; Type_std_attributes::set(item); name=item->name; - cached_field_type= item->field_type(); - cached_result_type= item->result_type(); + set_handler_by_field_type(item->field_type()); fixed= item->fixed; } @@ -4596,8 +4590,13 @@ public: Item *get_item() { return item; } /** All of the subclasses should have the same type tag */ enum Type type() const { return COPY_STR_ITEM; } - enum_field_types field_type() const { return cached_field_type; } - enum Item_result result_type () const { return cached_result_type; } + + 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 + { 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; } |