@@ -4539,25 +4539,20 @@ class Item_int_with_ref :public Item_int
4539
4539
from Item_).
4540
4540
*/
4541
4541
4542
- class Item_copy :public Item
4542
+ class Item_copy :public Item ,
4543
+ public Type_handler_hybrid_field_type
4543
4544
{
4544
4545
protected:
4545
4546
4546
4547
/* *
4547
- Stores the type of the resulting field that would be used to store the data
4548
+ Type_handler_hybrid_field_type is used to
4549
+ store the type of the resulting field that would be used to store the data
4548
4550
in the cache. This is to avoid calls to the original item.
4549
4551
*/
4550
- enum enum_field_types cached_field_type;
4551
4552
4552
4553
/* * The original item that is copied */
4553
4554
Item *item;
4554
4555
4555
- /* *
4556
- Stores the result type of the original item, so it can be returned
4557
- without calling the original item's method
4558
- */
4559
- Item_result cached_result_type;
4560
-
4561
4556
/* *
4562
4557
Constructor of the Item_copy class
4563
4558
@@ -4570,8 +4565,7 @@ class Item_copy :public Item
4570
4565
null_value=maybe_null=item->maybe_null ;
4571
4566
Type_std_attributes::set (item);
4572
4567
name=item->name ;
4573
- cached_field_type= item->field_type ();
4574
- cached_result_type= item->result_type ();
4568
+ set_handler_by_field_type (item->field_type ());
4575
4569
fixed= item->fixed ;
4576
4570
}
4577
4571
@@ -4596,8 +4590,13 @@ class Item_copy :public Item
4596
4590
Item *get_item () { return item; }
4597
4591
/* * All of the subclasses should have the same type tag */
4598
4592
enum Type type () const { return COPY_STR_ITEM; }
4599
- enum_field_types field_type () const { return cached_field_type; }
4600
- enum Item_result result_type () const { return cached_result_type; }
4593
+
4594
+ enum_field_types field_type () const
4595
+ { return Type_handler_hybrid_field_type::field_type (); }
4596
+ enum Item_result result_type () const
4597
+ { return Type_handler_hybrid_field_type::result_type (); }
4598
+ enum Item_result cmp_type () const
4599
+ { return Type_handler_hybrid_field_type::cmp_type (); }
4601
4600
4602
4601
void make_field (THD *thd, Send_field *field) { item->make_field (thd, field); }
4603
4602
table_map used_tables () const { return (table_map) 1L ; }
0 commit comments