mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
String::set(double) and set(longlong) -> set_real() and set_int()
fix Field::store(double) being used instead of store(longlong) NB: overloading functions is evil
This commit is contained in:
@ -1024,7 +1024,7 @@ String *field_decimal::avg(String *s, ha_rows rows)
|
||||
{
|
||||
if (!(rows - nulls))
|
||||
{
|
||||
s->set((double) 0.0, 1,my_thd_charset);
|
||||
s->set_real((double) 0.0, 1,my_thd_charset);
|
||||
return s;
|
||||
}
|
||||
my_decimal num, avg_val, rounded_avg;
|
||||
@ -1045,7 +1045,7 @@ String *field_decimal::std(String *s, ha_rows rows)
|
||||
{
|
||||
if (!(rows - nulls))
|
||||
{
|
||||
s->set((double) 0.0, 1,my_thd_charset);
|
||||
s->set_real((double) 0.0, 1,my_thd_charset);
|
||||
return s;
|
||||
}
|
||||
my_decimal num, tmp, sum2, sum2d;
|
||||
@ -1058,7 +1058,7 @@ String *field_decimal::std(String *s, ha_rows rows)
|
||||
my_decimal_sub(E_DEC_FATAL_ERROR, &sum2, sum_sqr+cur_sum, &tmp);
|
||||
my_decimal_div(E_DEC_FATAL_ERROR, &tmp, &sum2, &num, prec_increment);
|
||||
my_decimal2double(E_DEC_FATAL_ERROR, &tmp, &std_sqr);
|
||||
s->set(((double) std_sqr <= 0.0 ? 0.0 : sqrt(std_sqr)),
|
||||
s->set_real(((double) std_sqr <= 0.0 ? 0.0 : sqrt(std_sqr)),
|
||||
min(item->decimals + prec_increment, NOT_FIXED_DEC), my_thd_charset);
|
||||
|
||||
return s;
|
||||
@ -1092,7 +1092,7 @@ int collect_real(double *element, element_count count __attribute__((unused)),
|
||||
else
|
||||
info->found = 1;
|
||||
info->str->append('\'');
|
||||
s.set(*element, info->item->decimals, current_thd->charset());
|
||||
s.set_real(*element, info->item->decimals, current_thd->charset());
|
||||
info->str->append(s);
|
||||
info->str->append('\'');
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user