1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8

User visible change:
Removing the length specified by user from error messages:
ER_TOO_BIG_SCALE and ER_TOO_BIG_PRECISION
as discussed with Sergei.
This commit is contained in:
Alexander Barkov
2022-02-09 17:59:38 +04:00
parent ab1a792571
commit d25b10fede
34 changed files with 367 additions and 175 deletions

View File

@@ -11488,14 +11488,42 @@ Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item,
}
void Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
const char *length,
uint32 flags)
void
Lex_length_and_dec_st::set(const char *plength, const char *pdec)
{
reset();
if ((m_has_explicit_length= (plength != nullptr)))
{
int err;
ulonglong tmp= my_strtoll10(plength, NULL, &err);
if ((m_length_overflowed= (tmp > UINT_MAX32 || err)))
m_length= UINT_MAX32;
else
m_length= (uint32) tmp;
}
if ((m_has_explicit_dec= (pdec != nullptr)))
{
int err;
ulonglong tmp= my_strtoll10(pdec, NULL, &err);
if ((m_dec_overflowed= (tmp > 255 || err)))
m_dec= 255;
else
m_dec= (uint8) tmp;
}
}
void
Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
const Lex_length_and_dec_st &attr,
uint32 flags)
{
DBUG_ASSERT(!handler->is_unsigned());
set(handler, attr);
if (flags & UNSIGNED_FLAG)
handler= handler->type_handler_unsigned();
set(handler, length, NULL);
m_handler= m_handler->type_handler_unsigned();
}