summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-03-12 17:55:33 +0400
committerunknown <vva@eagle.mysql.r18.ru>2004-03-12 17:55:33 +0400
commit3df8aa831ed1efa616fea2469f281aace8a6d074 (patch)
tree78048f04909e46c32fc973b9886e82ee0013cfbc /sql/table.cc
parent997f11f270b123baa34060026905930c43ea40b3 (diff)
downloadmariadb-git-3df8aa831ed1efa616fea2469f281aace8a6d074.tar.gz
extra correction of check_db_name, check_table_name and check_column_name
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc32
1 files changed, 14 insertions, 18 deletions
diff --git a/sql/table.cc b/sql/table.cc
index ffe901b9061..a495f1d4f6d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1140,7 +1140,7 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
bool check_db_name(char *name)
{
char *start=name;
- bool space= false;
+ bool last_char_is_space= FALSE;
if (lower_case_table_names)
casedn_str(name);
@@ -1148,7 +1148,7 @@ bool check_db_name(char *name)
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(default_charset_info, *name);
if (use_mb(default_charset_info))
{
int len=my_ismbchar(default_charset_info, name, name+MBMAXLEN);
@@ -1159,16 +1159,14 @@ bool check_db_name(char *name)
}
}
#else
- space= *name==' ';
+ last_char_is_space= *name==' ';
#endif
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR)
return 1;
name++;
}
- if (space)
- return 1;
- return name[-1]==' ' || (uint) (name - start) > NAME_LEN;
+ return last_char_is_space || (uint) (name - start) > NAME_LEN;
}
@@ -1186,7 +1184,7 @@ bool check_table_name(const char *name, uint length)
if (!length || length > NAME_LEN)
return 1;
#if defined(USE_MB) && defined(USE_MB_IDENT)
- bool space= false;
+ bool last_char_is_space= FALSE;
#else
if (name[length-1]==' ')
return 1;
@@ -1195,7 +1193,7 @@ bool check_table_name(const char *name, uint length)
while (name != end)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(default_charset_info, *name);
if (use_mb(default_charset_info))
{
int len=my_ismbchar(default_charset_info, name, end);
@@ -1211,21 +1209,21 @@ bool check_table_name(const char *name, uint length)
name++;
}
#if defined(USE_MB) && defined(USE_MB_IDENT)
- if (space)
- return 1;
-#endif
+ return last_char_is_space;
+#else
return 0;
+#endif
}
bool check_column_name(const char *name)
{
const char *start= name;
- bool space= false;
-
+ bool last_char_is_space= false;
+
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
- space= my_isspace(default_charset_info, *name);
+ last_char_is_space= my_isspace(default_charset_info, *name);
if (use_mb(default_charset_info))
{
int len=my_ismbchar(default_charset_info, name, name+MBMAXLEN);
@@ -1236,16 +1234,14 @@ bool check_column_name(const char *name)
}
}
#else
- space= *name==' ';
+ last_char_is_space= *name==' ';
#endif
if (*name == NAMES_SEP_CHAR)
return 1;
name++;
}
- if (space)
- return 1;
/* Error if empty or too long column name */
- return (name == start || (uint) (name - start) > NAME_LEN);
+ return last_char_is_space || (name == start || (uint) (name - start) > NAME_LEN);
}
/*