Commit 0f642188 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-12771 Remove Item_func_xxx::decimal_precision() for case and abbreviations

parent cd32f842
......@@ -2218,16 +2218,6 @@ void Item_func_between::print(String *str, enum_query_type query_type)
}
uint Item_func_case_abbreviation2::decimal_precision2(Item **args) const
{
int arg0_int_part= args[0]->decimal_int_part();
int arg1_int_part= args[1]->decimal_int_part();
int max_int_part= MY_MAX(arg0_int_part, arg1_int_part);
int precision= max_int_part + decimals;
return MY_MIN(precision, DECIMAL_MAX_PRECISION);
}
double
Item_func_ifnull::real_op()
{
......@@ -3201,18 +3191,6 @@ Item* Item_func_case::propagate_equal_fields(THD *thd, const Context &ctx, COND_
}
uint Item_func_case::decimal_precision() const
{
int max_int_part=0;
for (uint i=0 ; i < ncases ; i+=2)
set_if_bigger(max_int_part, args[i+1]->decimal_int_part());
if (else_expr_num != -1)
set_if_bigger(max_int_part, args[else_expr_num]->decimal_int_part());
return MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION);
}
/**
@todo
Fix this so that it prints the whole CASE expression
......
......@@ -1009,7 +1009,6 @@ class Item_func_case_abbreviation2 :public Item_func_case_expression
if (!aggregate_for_result(func_name(), items, 2, true))
fix_attributes(items, 2);
}
uint decimal_precision2(Item **args) const;
void cache_type_info(const Item *source, bool maybe_null_arg)
{
......@@ -1064,10 +1063,6 @@ class Item_func_ifnull :public Item_func_case_abbreviation2
const char *func_name() const { return "ifnull"; }
table_map not_null_tables() const { return 0; }
uint decimal_precision() const
{
return Item_func_case_abbreviation2::decimal_precision2(args);
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_ifnull>(thd, mem_root, this); }
};
......@@ -1128,10 +1123,6 @@ class Item_func_if :public Item_func_case_abbreviation2_switch
{
fix_length_and_dec2_eliminate_null(args + 1);
}
uint decimal_precision() const
{
return Item_func_case_abbreviation2::decimal_precision2(args + 1);
}
const char *func_name() const { return "if"; }
bool eval_not_null_tables(void *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
......@@ -1156,10 +1147,6 @@ class Item_func_nvl2 :public Item_func_case_abbreviation2_switch
{
fix_length_and_dec2_eliminate_null(args + 1);
}
uint decimal_precision() const
{
return Item_func_case_abbreviation2::decimal_precision2(args + 1);
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_nvl2>(thd, mem_root, this); }
};
......@@ -1219,7 +1206,6 @@ class Item_func_nullif :public Item_func_case_expression
my_decimal *decimal_op(my_decimal *);
void fix_length_and_dec();
bool walk(Item_processor processor, bool walk_subquery, void *arg);
uint decimal_precision() const { return args[2]->decimal_precision(); }
const char *func_name() const { return "nullif"; }
void print(String *str, enum_query_type query_type);
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
......@@ -2056,7 +2042,6 @@ class Item_func_case :public Item_func_case_expression,
bool date_op(MYSQL_TIME *ltime, uint fuzzydate);
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
uint decimal_precision() const;
table_map not_null_tables() const { return 0; }
const char *func_name() const { return "case"; }
enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment