1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.3' into 10.4

This commit is contained in:
Oleksandr Byelkin
2019-05-19 20:55:37 +02:00
3893 changed files with 11766 additions and 6460 deletions

View File

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "mariadb.h"
#include "sql_type.h"
@ -134,6 +134,32 @@ bool Type_handler_data::init()
Type_handler_data *type_handler_data= NULL;
bool Float::to_string(String *val_buffer, uint dec) const
{
uint to_length= 70;
if (val_buffer->alloc(to_length))
return true;
char *to=(char*) val_buffer->ptr();
size_t len;
if (dec >= FLOATING_POINT_DECIMALS)
len= my_gcvt(m_value, MY_GCVT_ARG_FLOAT, to_length - 1, to, NULL);
else
{
/*
We are safe here because the buffer length is 70, and
fabs(float) < 10^39, dec < FLOATING_POINT_DECIMALS. So the resulting string
will be not longer than 69 chars + terminating '\0'.
*/
len= my_fcvt(m_value, (int) dec, to, NULL);
}
val_buffer->length((uint) len);
val_buffer->set_charset(&my_charset_numeric);
return false;
}
String_ptr::String_ptr(Item *item, String *buffer)
:m_string_ptr(item->val_str(buffer))
{ }
@ -3747,9 +3773,15 @@ Type_handler_year::Item_get_cache(THD *thd, const Item *item) const
}
Item_cache *
Type_handler_real_result::Item_get_cache(THD *thd, const Item *item) const
Type_handler_double::Item_get_cache(THD *thd, const Item *item) const
{
return new (thd->mem_root) Item_cache_real(thd);
return new (thd->mem_root) Item_cache_double(thd);
}
Item_cache *
Type_handler_float::Item_get_cache(THD *thd, const Item *item) const
{
return new (thd->mem_root) Item_cache_float(thd);
}
Item_cache *
@ -4730,13 +4762,24 @@ Type_handler_int_result::Item_func_hybrid_field_type_get_date(
/***************************************************************************/
String *
Type_handler_real_result::Item_func_hybrid_field_type_val_str(
Type_handler_double::Item_func_hybrid_field_type_val_str(
Item_func_hybrid_field_type *item,
String *str) const
{
return item->val_str_from_real_op(str);
}
String *
Type_handler_float::Item_func_hybrid_field_type_val_str(
Item_func_hybrid_field_type *item,
String *str) const
{
Float nr(item->real_op());
if (item->null_value)
return 0;
nr.to_string(str, item->decimals);
return str;
}
double
Type_handler_real_result::Item_func_hybrid_field_type_val_real(
@ -5260,13 +5303,24 @@ String *Type_handler_decimal_result::
}
String *Type_handler_real_result::
String *Type_handler_double::
Item_func_min_max_val_str(Item_func_min_max *func, String *str) const
{
return func->val_string_from_real(str);
}
String *Type_handler_float::
Item_func_min_max_val_str(Item_func_min_max *func, String *str) const
{
Float nr(func->val_real());
if (func->null_value)
return 0;
nr.to_string(str, func->decimals);
return str;
}
double Type_handler_string_result::
Item_func_min_max_val_real(Item_func_min_max *func) const
{
@ -5888,6 +5942,14 @@ bool Type_handler::
}
bool Type_handler::
Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
{
item->fix_length_and_dec_generic();
return false;
}
bool Type_handler::
Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
{
@ -5977,6 +6039,13 @@ bool Type_handler_geometry::
}
bool Type_handler_geometry::
Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
{
return Item_func_or_sum_illegal_param(item);
}
bool Type_handler_geometry::
Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
{
@ -7023,6 +7092,15 @@ Item *Type_handler_double::
}
Item *Type_handler_float::
create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const
{
DBUG_ASSERT(!attr.length_specified());
return new (thd->mem_root) Item_float_typecast(thd, item);
}
Item *Type_handler_long_blob::
create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const