Check for empty table/column names

mysql-test/t/create.test:
  Test for empty table/column name
tests/grant.pl:
  More tests
tests/grant.res:
  More tests
This commit is contained in:
unknown 2003-03-14 17:08:42 +02:00
commit 03b0df9481
6 changed files with 35 additions and 10 deletions

View file

@ -1099,6 +1099,8 @@ bool check_db_name(char *name)
bool check_table_name(const char *name, uint length)
{
const char *end= name+length;
if (!length || length > NAME_LEN)
return 1;
while (name != end)
{
@ -1122,6 +1124,8 @@ bool check_table_name(const char *name, uint length)
bool check_column_name(const char *name)
{
const char *start= name;
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
@ -1139,7 +1143,8 @@ bool check_column_name(const char *name)
return 1;
name++;
}
return 0;
/* Error if empty or too long column name */
return (name == start || (uint) (name - start) > NAME_LEN);
}
/*