mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
A cleanup: removing duplicate code: Item_func::val_decimal()
Using val_decimal_from_int() instead, which provides exactly the same functionality.
This commit is contained in:
parent
3e27677b59
commit
d5f5cd2831
4 changed files with 17 additions and 12 deletions
|
@ -329,6 +329,7 @@ my_decimal *Item::val_decimal_from_real(my_decimal *decimal_value)
|
|||
|
||||
my_decimal *Item::val_decimal_from_int(my_decimal *decimal_value)
|
||||
{
|
||||
DBUG_ASSERT(is_fixed());
|
||||
longlong nr= val_int();
|
||||
if (null_value)
|
||||
return 0;
|
||||
|
|
|
@ -646,16 +646,6 @@ bool Item_func::is_expensive_processor(uchar *arg)
|
|||
}
|
||||
*/
|
||||
|
||||
my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
DBUG_ASSERT(fixed);
|
||||
longlong nr= val_int();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
|
||||
return decimal_value;
|
||||
}
|
||||
|
||||
|
||||
bool Item_hybrid_func::fix_attributes(Item **items, uint nitems)
|
||||
{
|
||||
|
|
|
@ -192,8 +192,6 @@ public:
|
|||
{ return tmp_table_field_from_field_type(root, table); }
|
||||
Item *get_tmp_table_item(THD *thd);
|
||||
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
|
||||
void fix_char_length_ulonglong(ulonglong max_char_length_arg)
|
||||
{
|
||||
ulonglong max_result_length= max_char_length_arg *
|
||||
|
@ -1005,6 +1003,10 @@ public:
|
|||
{ collation.set_numeric(); }
|
||||
double val_real();
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
return val_decimal_from_int(decimal_value);
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{ return get_date_from_int(thd, ltime, fuzzydate); }
|
||||
const Type_handler *type_handler() const= 0;
|
||||
|
@ -2424,6 +2426,10 @@ public:
|
|||
Item_udf_func(thd, udf_arg, list) {}
|
||||
longlong val_int();
|
||||
double val_real() { return (double) Item_func_udf_int::val_int(); }
|
||||
my_decimal *val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
return val_decimal_from_int(decimal_value);
|
||||
}
|
||||
String *val_str(String *str);
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; }
|
||||
|
|
|
@ -182,6 +182,10 @@ public:
|
|||
str->set(nr, collation.collation);
|
||||
return str;
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
return val_decimal_from_int(decimal_value);
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
return get_date_from_int(thd, ltime, fuzzydate);
|
||||
|
@ -451,6 +455,10 @@ public:
|
|||
str->set(val_int(), &my_charset_bin);
|
||||
return null_value ? 0 : str;
|
||||
}
|
||||
my_decimal *val_decimal(my_decimal *decimal_value)
|
||||
{
|
||||
return val_decimal_from_int(decimal_value);
|
||||
}
|
||||
const char *func_name() const
|
||||
{
|
||||
return (odbc_type ? "dayofweek" : "weekday");
|
||||
|
|
Loading…
Add table
Reference in a new issue