mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-20732 MDB now correctly estimates a length of the FORMAT() result for
doubles in scientific notation with a big integer part.
This commit is contained in:
@ -3490,7 +3490,6 @@ uint32 Type_handler_temporal_result::max_display_length(const Item *item) const
|
||||
return item->max_length;
|
||||
}
|
||||
|
||||
|
||||
uint32 Type_handler_string_result::max_display_length(const Item *item) const
|
||||
{
|
||||
return item->max_length;
|
||||
@ -3515,6 +3514,50 @@ uint32 Type_handler_general_purpose_int::max_display_length(const Item *item)
|
||||
return type_limits_int_by_unsigned_flag(item->unsigned_flag)->char_length();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
uint32
|
||||
Type_handler_decimal_result::Item_decimal_notation_int_digits(const Item *item)
|
||||
const
|
||||
{
|
||||
return item->decimal_int_part();
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
Type_handler_temporal_result::Item_decimal_notation_int_digits(const Item *item)
|
||||
const
|
||||
{
|
||||
return item->decimal_int_part();
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
Type_handler_bit::Item_decimal_notation_int_digits(const Item *item)
|
||||
const
|
||||
{
|
||||
return Bit_decimal_notation_int_digits(item);
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
Type_handler_general_purpose_int::Item_decimal_notation_int_digits(
|
||||
const Item *item) const
|
||||
{
|
||||
return type_limits_int_by_unsigned_flag(item->unsigned_flag)->precision();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
Decimal to binary digits ratio converges to log2(10) thus using 3 as
|
||||
a divisor.
|
||||
*/
|
||||
uint32
|
||||
Type_handler_bit::Bit_decimal_notation_int_digits(const Item *item)
|
||||
{
|
||||
return item->max_length/3+1;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
Reference in New Issue
Block a user