@@ -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*/
0 commit comments