mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
Review fix for BUG#17015: Routine name truncation not an error
sql/field.h: Added new method to Field class: char_length() sql/sp.cc: Use Field::char_length() to check number of characters in the name field.
This commit is contained in:
parent
8dd6e1454a
commit
e550d6e7e3
2 changed files with 10 additions and 5 deletions
|
|
@ -319,6 +319,12 @@ public:
|
||||||
/* convert decimal to longlong with overflow check */
|
/* convert decimal to longlong with overflow check */
|
||||||
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
|
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
|
||||||
int *err);
|
int *err);
|
||||||
|
/* The max. number of characters */
|
||||||
|
inline uint32 Field::char_length() const
|
||||||
|
{
|
||||||
|
return field_length / charset()->mbmaxlen;
|
||||||
|
}
|
||||||
|
|
||||||
friend bool reopen_table(THD *,struct st_table *,bool);
|
friend bool reopen_table(THD *,struct st_table *,bool);
|
||||||
friend int cre_myisam(my_string name, register TABLE *form, uint options,
|
friend int cre_myisam(my_string name, register TABLE *form, uint options,
|
||||||
ulonglong auto_increment_value);
|
ulonglong auto_increment_value);
|
||||||
|
|
|
||||||
|
|
@ -509,11 +509,10 @@ db_create_routine(THD *thd, int type, sp_head *sp)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((system_charset_info->cset->numchars(system_charset_info,
|
if (system_charset_info->cset->numchars(system_charset_info,
|
||||||
sp->m_name.str,
|
sp->m_name.str,
|
||||||
sp->m_name.str+sp->m_name.length) *
|
sp->m_name.str+sp->m_name.length) >
|
||||||
table->field[MYSQL_PROC_FIELD_NAME]->charset()->mbmaxlen) >
|
table->field[MYSQL_PROC_FIELD_NAME]->char_length())
|
||||||
table->field[MYSQL_PROC_FIELD_NAME]->field_length)
|
|
||||||
{
|
{
|
||||||
ret= SP_BAD_IDENTIFIER;
|
ret= SP_BAD_IDENTIFIER;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue