1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +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

@ -3336,28 +3336,21 @@ class Type_cast_attributes
bool m_length_specified;
bool m_decimals_specified;
public:
Type_cast_attributes(const char *c_len, const char *c_dec, CHARSET_INFO *cs)
Type_cast_attributes(const Lex_length_and_dec_st &length_and_dec,
CHARSET_INFO *cs)
:m_charset(cs), m_length(0), m_decimals(0),
m_length_specified(false), m_decimals_specified(false)
{
set_length_and_dec(c_len, c_dec);
m_length= length_and_dec.length_overflowed() ? (ulonglong) UINT_MAX32 + 1 :
length_and_dec.length();
m_decimals= length_and_dec.dec();
m_length_specified= length_and_dec.has_explicit_length();
m_decimals_specified= length_and_dec.has_explicit_dec();
}
Type_cast_attributes(CHARSET_INFO *cs)
:m_charset(cs), m_length(0), m_decimals(0),
m_length_specified(false), m_decimals_specified(false)
{ }
void set_length_and_dec(const char *c_len, const char *c_dec)
{
int error;
/*
We don't have to check for error here as sql_yacc.yy has guaranteed
that the values are in range of ulonglong
*/
if ((m_length_specified= (c_len != NULL)))
m_length= (ulonglong) my_strtoll10(c_len, NULL, &error);
if ((m_decimals_specified= (c_dec != NULL)))
m_decimals= (ulonglong) my_strtoll10(c_dec, NULL, &error);
}
CHARSET_INFO *charset() const { return m_charset; }
bool length_specified() const { return m_length_specified; }
bool decimals_specified() const { return m_decimals_specified; }