diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-09-20 17:11:36 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-09-20 17:11:36 +0400 |
commit | e07118946a82af60c7cc3804c321d3fd9a49f128 (patch) | |
tree | c2d3ced19d357c93d5906aee038d91d406b37c2f | |
parent | 935a163dd9242457fe56e73b2c2932230579aef5 (diff) | |
download | mariadb-git-e07118946a82af60c7cc3804c321d3fd9a49f128.tar.gz |
MDEV-17250 Remove unused Item_copy_xxx
-rw-r--r-- | sql/item.cc | 175 | ||||
-rw-r--r-- | sql/item.h | 90 |
2 files changed, 0 insertions, 265 deletions
diff --git a/sql/item.cc b/sql/item.cc index e1afc339cc2..d2e3b847f5c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4169,31 +4169,6 @@ void Item_param::make_field(Send_field *field) field->type= m_out_param_info->type; } -/**************************************************************************** - Item_copy -****************************************************************************/ - -Item_copy *Item_copy::create (Item *item) -{ - switch (item->result_type()) - { - case STRING_RESULT: - return new Item_copy_string (item); - case REAL_RESULT: - return new Item_copy_float (item); - case INT_RESULT: - return item->unsigned_flag ? - new Item_copy_uint (item) : new Item_copy_int (item); - case DECIMAL_RESULT: - return new Item_copy_decimal (item); - case TIME_RESULT: - case ROW_RESULT: - case IMPOSSIBLE_RESULT: - DBUG_ASSERT (0); - } - /* should not happen */ - return NULL; -} /**************************************************************************** Item_copy_string @@ -4251,156 +4226,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value) } -/**************************************************************************** - Item_copy_int -****************************************************************************/ - -void Item_copy_int::copy() -{ - cached_value= item->val_int(); - null_value=item->null_value; -} - -static int save_int_value_in_field (Field *, longlong, bool, bool); - -int Item_copy_int::save_in_field(Field *field, bool no_conversions) -{ - return save_int_value_in_field(field, cached_value, - null_value, unsigned_flag); -} - - -String *Item_copy_int::val_str(String *str) -{ - if (null_value) - return (String *) 0; - - str->set(cached_value, &my_charset_bin); - return str; -} - - -my_decimal *Item_copy_int::val_decimal(my_decimal *decimal_value) -{ - if (null_value) - return (my_decimal *) 0; - - int2my_decimal(E_DEC_FATAL_ERROR, cached_value, unsigned_flag, decimal_value); - return decimal_value; -} - - -/**************************************************************************** - Item_copy_uint -****************************************************************************/ - -String *Item_copy_uint::val_str(String *str) -{ - if (null_value) - return (String *) 0; - - str->set((ulonglong) cached_value, &my_charset_bin); - return str; -} - - -/**************************************************************************** - Item_copy_float -****************************************************************************/ - -String *Item_copy_float::val_str(String *str) -{ - if (null_value) - return (String *) 0; - else - { - double nr= val_real(); - str->set_real(nr,decimals, &my_charset_bin); - return str; - } -} - - -my_decimal *Item_copy_float::val_decimal(my_decimal *decimal_value) -{ - if (null_value) - return (my_decimal *) 0; - else - { - double nr= val_real(); - double2my_decimal(E_DEC_FATAL_ERROR, nr, decimal_value); - return decimal_value; - } -} - - -int Item_copy_float::save_in_field(Field *field, bool no_conversions) -{ - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store(cached_value); -} - - -/**************************************************************************** - Item_copy_decimal -****************************************************************************/ - -int Item_copy_decimal::save_in_field(Field *field, bool no_conversions) -{ - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store_decimal(&cached_value); -} - - -String *Item_copy_decimal::val_str(String *result) -{ - if (null_value) - return (String *) 0; - result->set_charset(&my_charset_bin); - my_decimal2string(E_DEC_FATAL_ERROR, &cached_value, 0, 0, 0, result); - return result; -} - - -double Item_copy_decimal::val_real() -{ - if (null_value) - return 0.0; - else - { - double result; - my_decimal2double(E_DEC_FATAL_ERROR, &cached_value, &result); - return result; - } -} - - -longlong Item_copy_decimal::val_int() -{ - if (null_value) - return LL(0); - else - { - longlong result; - my_decimal2int(E_DEC_FATAL_ERROR, &cached_value, unsigned_flag, &result); - return result; - } -} - - -void Item_copy_decimal::copy() -{ - my_decimal *nr= item->val_decimal(&cached_value); - if (nr && nr != &cached_value) - my_decimal2decimal (nr, &cached_value); - null_value= item->null_value; -} - - /* Functions to convert item to field (for send_result_set_metadata) */ diff --git a/sql/item.h b/sql/item.h index 1bded7377ee..dbcf6bc6d08 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3664,13 +3664,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 (Item *item); /** Update the cache with the value of the original item @@ -3732,89 +3725,6 @@ public: }; -class Item_copy_int : public Item_copy -{ -protected: - longlong cached_value; -public: - Item_copy_int (Item *i) : Item_copy(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 ? LL(0) : cached_value; - } - virtual void copy(); -}; - - -class Item_copy_uint : public Item_copy_int -{ -public: - Item_copy_uint (Item *item) : Item_copy_int(item) - { - unsigned_flag= 1; - } - - String *val_str(String*); - double val_real() - { - return null_value ? 0.0 : (double) (ulonglong) cached_value; - } -}; - - -class Item_copy_float : public Item_copy -{ -protected: - double cached_value; -public: - Item_copy_float (Item *i) : Item_copy(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; - } -}; - - -class Item_copy_decimal : public Item_copy -{ -protected: - my_decimal cached_value; -public: - Item_copy_decimal (Item *i) : Item_copy(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(); -}; - - /* Cached_item_XXX objects are not exactly caches. They do the following: |