diff options
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 100 |
1 files changed, 1 insertions, 99 deletions
diff --git a/sql/item.h b/sql/item.h index 1a280e3091f..8d02d981d38 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4970,7 +4970,7 @@ public: Base class to implement typed value caching Item classes Item_copy_ classes are very similar to the corresponding Item_ - classes (e.g. Item_copy_int is similar to Item_int) but they add + classes (e.g. Item_copy_string is similar to Item_string) but they add the following additional functionality to Item_ : 1. Nullability 2. Possibility to store the value not only on instantiation time, @@ -5017,13 +5017,6 @@ protected: } public: - /** - Factory method to create the appropriate subclass dependent on the type of - the original item. - - @param item the original item. - */ - static Item_copy *create(THD *thd, Item *item); /** Update the cache with the value of the original item @@ -5092,97 +5085,6 @@ public: }; -class Item_copy_int : public Item_copy -{ -protected: - longlong cached_value; -public: - Item_copy_int(THD *thd, Item *i): Item_copy(thd, i) {} - int save_in_field(Field *field, bool no_conversions); - - virtual String *val_str(String*); - virtual my_decimal *val_decimal(my_decimal *); - virtual double val_real() - { - return null_value ? 0.0 : (double) cached_value; - } - virtual longlong val_int() - { - return null_value ? 0 : cached_value; - } - virtual void copy(); - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_copy_int>(thd, mem_root, this); } -}; - - -class Item_copy_uint : public Item_copy_int -{ -public: - Item_copy_uint(THD *thd, Item *item_arg): Item_copy_int(thd, item_arg) - { - unsigned_flag= 1; - } - - String *val_str(String*); - double val_real() - { - return null_value ? 0.0 : (double) (ulonglong) cached_value; - } - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_copy_uint>(thd, mem_root, this); } -}; - - -class Item_copy_float : public Item_copy -{ -protected: - double cached_value; -public: - Item_copy_float(THD *thd, Item *i): Item_copy(thd, i) {} - int save_in_field(Field *field, bool no_conversions); - - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - double val_real() - { - return null_value ? 0.0 : cached_value; - } - longlong val_int() - { - return (longlong) rint(val_real()); - } - void copy() - { - cached_value= item->val_real(); - null_value= item->null_value; - } - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_copy_float>(thd, mem_root, this); } -}; - - -class Item_copy_decimal : public Item_copy -{ -protected: - my_decimal cached_value; -public: - Item_copy_decimal(THD *thd, Item *i): Item_copy(thd, i) {} - int save_in_field(Field *field, bool no_conversions); - - String *val_str(String*); - my_decimal *val_decimal(my_decimal *) - { - return null_value ? NULL: &cached_value; - } - double val_real(); - longlong val_int(); - void copy(); - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_copy_decimal>(thd, mem_root, this); } -}; - - /* Cached_item_XXX objects are not exactly caches. They do the following: |