Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7430fc2e
Commit
7430fc2e
authored
Mar 12, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extra correction of check_db_name, check_table_name and check_column_name
parent
8550c7ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
sql/table.cc
sql/table.cc
+14
-18
No files found.
sql/table.cc
View file @
7430fc2e
...
@@ -1140,7 +1140,7 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
...
@@ -1140,7 +1140,7 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
bool
check_db_name
(
char
*
name
)
bool
check_db_name
(
char
*
name
)
{
{
char
*
start
=
name
;
char
*
start
=
name
;
bool
space
=
false
;
bool
last_char_is_space
=
FALSE
;
if
(
lower_case_table_names
)
if
(
lower_case_table_names
)
casedn_str
(
name
);
casedn_str
(
name
);
...
@@ -1148,7 +1148,7 @@ bool check_db_name(char *name)
...
@@ -1148,7 +1148,7 @@ bool check_db_name(char *name)
while
(
*
name
)
while
(
*
name
)
{
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
#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
))
if
(
use_mb
(
default_charset_info
))
{
{
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
name
+
MBMAXLEN
);
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
name
+
MBMAXLEN
);
...
@@ -1159,16 +1159,14 @@ bool check_db_name(char *name)
...
@@ -1159,16 +1159,14 @@ bool check_db_name(char *name)
}
}
}
}
#else
#else
space
=
*
name
==
' '
;
last_char_is_
space
=
*
name
==
' '
;
#endif
#endif
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
*
name
==
FN_EXTCHAR
)
*
name
==
FN_EXTCHAR
)
return
1
;
return
1
;
name
++
;
name
++
;
}
}
if
(
space
)
return
last_char_is_space
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
return
1
;
return
name
[
-
1
]
==
' '
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
}
}
...
@@ -1186,7 +1184,7 @@ bool check_table_name(const char *name, uint length)
...
@@ -1186,7 +1184,7 @@ bool check_table_name(const char *name, uint length)
if
(
!
length
||
length
>
NAME_LEN
)
if
(
!
length
||
length
>
NAME_LEN
)
return
1
;
return
1
;
#if defined(USE_MB) && defined(USE_MB_IDENT)
#if defined(USE_MB) && defined(USE_MB_IDENT)
bool
space
=
false
;
bool
last_char_is_space
=
FALSE
;
#else
#else
if
(
name
[
length
-
1
]
==
' '
)
if
(
name
[
length
-
1
]
==
' '
)
return
1
;
return
1
;
...
@@ -1195,7 +1193,7 @@ bool check_table_name(const char *name, uint length)
...
@@ -1195,7 +1193,7 @@ bool check_table_name(const char *name, uint length)
while
(
name
!=
end
)
while
(
name
!=
end
)
{
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
#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
))
if
(
use_mb
(
default_charset_info
))
{
{
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
end
);
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
end
);
...
@@ -1211,21 +1209,21 @@ bool check_table_name(const char *name, uint length)
...
@@ -1211,21 +1209,21 @@ bool check_table_name(const char *name, uint length)
name
++
;
name
++
;
}
}
#if defined(USE_MB) && defined(USE_MB_IDENT)
#if defined(USE_MB) && defined(USE_MB_IDENT)
if
(
space
)
return
last_char_is_space
;
return
1
;
#else
#endif
return
0
;
return
0
;
#endif
}
}
bool
check_column_name
(
const
char
*
name
)
bool
check_column_name
(
const
char
*
name
)
{
{
const
char
*
start
=
name
;
const
char
*
start
=
name
;
bool
space
=
false
;
bool
last_char_is_
space
=
false
;
while
(
*
name
)
while
(
*
name
)
{
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
#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
))
if
(
use_mb
(
default_charset_info
))
{
{
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
name
+
MBMAXLEN
);
int
len
=
my_ismbchar
(
default_charset_info
,
name
,
name
+
MBMAXLEN
);
...
@@ -1236,16 +1234,14 @@ bool check_column_name(const char *name)
...
@@ -1236,16 +1234,14 @@ bool check_column_name(const char *name)
}
}
}
}
#else
#else
space
=
*
name
==
' '
;
last_char_is_
space
=
*
name
==
' '
;
#endif
#endif
if
(
*
name
==
NAMES_SEP_CHAR
)
if
(
*
name
==
NAMES_SEP_CHAR
)
return
1
;
return
1
;
name
++
;
name
++
;
}
}
if
(
space
)
return
1
;
/* Error if empty or too long column name */
/* 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
);
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment