Skip to content

Commit e071189

Browse files
committed
MDEV-17250 Remove unused Item_copy_xxx
1 parent 935a163 commit e071189

File tree

2 files changed

+0
-265
lines changed

2 files changed

+0
-265
lines changed

sql/item.cc

Lines changed: 0 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,31 +4169,6 @@ void Item_param::make_field(Send_field *field)
41694169
field->type= m_out_param_info->type;
41704170
}
41714171

4172-
/****************************************************************************
4173-
Item_copy
4174-
****************************************************************************/
4175-
4176-
Item_copy *Item_copy::create (Item *item)
4177-
{
4178-
switch (item->result_type())
4179-
{
4180-
case STRING_RESULT:
4181-
return new Item_copy_string (item);
4182-
case REAL_RESULT:
4183-
return new Item_copy_float (item);
4184-
case INT_RESULT:
4185-
return item->unsigned_flag ?
4186-
new Item_copy_uint (item) : new Item_copy_int (item);
4187-
case DECIMAL_RESULT:
4188-
return new Item_copy_decimal (item);
4189-
case TIME_RESULT:
4190-
case ROW_RESULT:
4191-
case IMPOSSIBLE_RESULT:
4192-
DBUG_ASSERT (0);
4193-
}
4194-
/* should not happen */
4195-
return NULL;
4196-
}
41974172

41984173
/****************************************************************************
41994174
Item_copy_string
@@ -4251,156 +4226,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value)
42514226
}
42524227

42534228

4254-
/****************************************************************************
4255-
Item_copy_int
4256-
****************************************************************************/
4257-
4258-
void Item_copy_int::copy()
4259-
{
4260-
cached_value= item->val_int();
4261-
null_value=item->null_value;
4262-
}
4263-
4264-
static int save_int_value_in_field (Field *, longlong, bool, bool);
4265-
4266-
int Item_copy_int::save_in_field(Field *field, bool no_conversions)
4267-
{
4268-
return save_int_value_in_field(field, cached_value,
4269-
null_value, unsigned_flag);
4270-
}
4271-
4272-
4273-
String *Item_copy_int::val_str(String *str)
4274-
{
4275-
if (null_value)
4276-
return (String *) 0;
4277-
4278-
str->set(cached_value, &my_charset_bin);
4279-
return str;
4280-
}
4281-
4282-
4283-
my_decimal *Item_copy_int::val_decimal(my_decimal *decimal_value)
4284-
{
4285-
if (null_value)
4286-
return (my_decimal *) 0;
4287-
4288-
int2my_decimal(E_DEC_FATAL_ERROR, cached_value, unsigned_flag, decimal_value);
4289-
return decimal_value;
4290-
}
4291-
4292-
4293-
/****************************************************************************
4294-
Item_copy_uint
4295-
****************************************************************************/
4296-
4297-
String *Item_copy_uint::val_str(String *str)
4298-
{
4299-
if (null_value)
4300-
return (String *) 0;
4301-
4302-
str->set((ulonglong) cached_value, &my_charset_bin);
4303-
return str;
4304-
}
4305-
4306-
4307-
/****************************************************************************
4308-
Item_copy_float
4309-
****************************************************************************/
4310-
4311-
String *Item_copy_float::val_str(String *str)
4312-
{
4313-
if (null_value)
4314-
return (String *) 0;
4315-
else
4316-
{
4317-
double nr= val_real();
4318-
str->set_real(nr,decimals, &my_charset_bin);
4319-
return str;
4320-
}
4321-
}
4322-
4323-
4324-
my_decimal *Item_copy_float::val_decimal(my_decimal *decimal_value)
4325-
{
4326-
if (null_value)
4327-
return (my_decimal *) 0;
4328-
else
4329-
{
4330-
double nr= val_real();
4331-
double2my_decimal(E_DEC_FATAL_ERROR, nr, decimal_value);
4332-
return decimal_value;
4333-
}
4334-
}
4335-
4336-
4337-
int Item_copy_float::save_in_field(Field *field, bool no_conversions)
4338-
{
4339-
if (null_value)
4340-
return set_field_to_null(field);
4341-
field->set_notnull();
4342-
return field->store(cached_value);
4343-
}
4344-
4345-
4346-
/****************************************************************************
4347-
Item_copy_decimal
4348-
****************************************************************************/
4349-
4350-
int Item_copy_decimal::save_in_field(Field *field, bool no_conversions)
4351-
{
4352-
if (null_value)
4353-
return set_field_to_null(field);
4354-
field->set_notnull();
4355-
return field->store_decimal(&cached_value);
4356-
}
4357-
4358-
4359-
String *Item_copy_decimal::val_str(String *result)
4360-
{
4361-
if (null_value)
4362-
return (String *) 0;
4363-
result->set_charset(&my_charset_bin);
4364-
my_decimal2string(E_DEC_FATAL_ERROR, &cached_value, 0, 0, 0, result);
4365-
return result;
4366-
}
4367-
4368-
4369-
double Item_copy_decimal::val_real()
4370-
{
4371-
if (null_value)
4372-
return 0.0;
4373-
else
4374-
{
4375-
double result;
4376-
my_decimal2double(E_DEC_FATAL_ERROR, &cached_value, &result);
4377-
return result;
4378-
}
4379-
}
4380-
4381-
4382-
longlong Item_copy_decimal::val_int()
4383-
{
4384-
if (null_value)
4385-
return LL(0);
4386-
else
4387-
{
4388-
longlong result;
4389-
my_decimal2int(E_DEC_FATAL_ERROR, &cached_value, unsigned_flag, &result);
4390-
return result;
4391-
}
4392-
}
4393-
4394-
4395-
void Item_copy_decimal::copy()
4396-
{
4397-
my_decimal *nr= item->val_decimal(&cached_value);
4398-
if (nr && nr != &cached_value)
4399-
my_decimal2decimal (nr, &cached_value);
4400-
null_value= item->null_value;
4401-
}
4402-
4403-
44044229
/*
44054230
Functions to convert item to field (for send_result_set_metadata)
44064231
*/

sql/item.h

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,13 +3664,6 @@ class Item_copy :public Item
36643664
}
36653665

36663666
public:
3667-
/**
3668-
Factory method to create the appropriate subclass dependent on the type of
3669-
the original item.
3670-
3671-
@param item the original item.
3672-
*/
3673-
static Item_copy *create (Item *item);
36743667

36753668
/**
36763669
Update the cache with the value of the original item
@@ -3732,89 +3725,6 @@ class Item_copy_string : public Item_copy
37323725
};
37333726

37343727

3735-
class Item_copy_int : public Item_copy
3736-
{
3737-
protected:
3738-
longlong cached_value;
3739-
public:
3740-
Item_copy_int (Item *i) : Item_copy(i) {}
3741-
int save_in_field(Field *field, bool no_conversions);
3742-
3743-
virtual String *val_str(String*);
3744-
virtual my_decimal *val_decimal(my_decimal *);
3745-
virtual double val_real()
3746-
{
3747-
return null_value ? 0.0 : (double) cached_value;
3748-
}
3749-
virtual longlong val_int()
3750-
{
3751-
return null_value ? LL(0) : cached_value;
3752-
}
3753-
virtual void copy();
3754-
};
3755-
3756-
3757-
class Item_copy_uint : public Item_copy_int
3758-
{
3759-
public:
3760-
Item_copy_uint (Item *item) : Item_copy_int(item)
3761-
{
3762-
unsigned_flag= 1;
3763-
}
3764-
3765-
String *val_str(String*);
3766-
double val_real()
3767-
{
3768-
return null_value ? 0.0 : (double) (ulonglong) cached_value;
3769-
}
3770-
};
3771-
3772-
3773-
class Item_copy_float : public Item_copy
3774-
{
3775-
protected:
3776-
double cached_value;
3777-
public:
3778-
Item_copy_float (Item *i) : Item_copy(i) {}
3779-
int save_in_field(Field *field, bool no_conversions);
3780-
3781-
String *val_str(String*);
3782-
my_decimal *val_decimal(my_decimal *);
3783-
double val_real()
3784-
{
3785-
return null_value ? 0.0 : cached_value;
3786-
}
3787-
longlong val_int()
3788-
{
3789-
return (longlong) rint(val_real());
3790-
}
3791-
void copy()
3792-
{
3793-
cached_value= item->val_real();
3794-
null_value= item->null_value;
3795-
}
3796-
};
3797-
3798-
3799-
class Item_copy_decimal : public Item_copy
3800-
{
3801-
protected:
3802-
my_decimal cached_value;
3803-
public:
3804-
Item_copy_decimal (Item *i) : Item_copy(i) {}
3805-
int save_in_field(Field *field, bool no_conversions);
3806-
3807-
String *val_str(String*);
3808-
my_decimal *val_decimal(my_decimal *)
3809-
{
3810-
return null_value ? NULL: &cached_value;
3811-
}
3812-
double val_real();
3813-
longlong val_int();
3814-
void copy();
3815-
};
3816-
3817-
38183728
/*
38193729
Cached_item_XXX objects are not exactly caches. They do the following:
38203730

0 commit comments

Comments
 (0)