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

MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1)

This commit is contained in:
Alexander Barkov
2017-05-15 14:58:05 +04:00
parent 38acc29ccb
commit 7c44b8afb7
6 changed files with 169 additions and 40 deletions

View File

@ -4180,6 +4180,104 @@ bool Type_handler_time_common::
/***************************************************************************/
bool Type_handler_row::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
DBUG_ASSERT(0);
param->set_null();
return true;
}
bool Type_handler_real_result::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= attr->unsigned_flag;
param->set_double(val->value.m_double);
param->set_handler(&type_handler_double);
return false;
}
bool Type_handler_int_result::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= attr->unsigned_flag;
param->set_int(val->value.m_longlong, MY_INT64_NUM_DECIMAL_DIGITS);
param->set_handler(&type_handler_longlong);
return false;
}
bool Type_handler_decimal_result::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= attr->unsigned_flag;
param->set_decimal(&val->m_decimal, attr->unsigned_flag);
param->set_handler(&type_handler_newdecimal);
return false;
}
bool Type_handler_string_result::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= false;
param->value.cs_info.set(thd, attr->collation.collation);
/*
Exact value of max_length is not known unless data is converted to
charset of connection, so we have to set it later.
*/
param->set_handler(&type_handler_varchar);
return param->set_str(val->m_string.ptr(), val->m_string.length());
}
bool Type_handler_temporal_result::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= attr->unsigned_flag;
param->set_time(&val->value.m_time, attr->max_length, attr->decimals);
param->set_handler(this);
return false;
}
#ifdef HAVE_SPATIAL
bool Type_handler_geometry::
Item_param_set_from_value(THD *thd,
Item_param *param,
const Type_all_attributes *attr,
const st_value *val) const
{
param->unsigned_flag= false;
param->value.cs_info.set(thd, &my_charset_bin);
param->set_handler(&type_handler_geometry);
param->set_geometry_type(attr->uint_geometry_type());
return param->set_str(val->m_string.ptr(), val->m_string.length());
}
#endif
/***************************************************************************/
bool Type_handler_null::
Item_send(Item *item, Protocol *protocol, st_value *buf) const
{