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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3df8aa83
Commit
3df8aa83
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
997f11f2
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 @
3df8aa83
...
...
@@ -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
);
}
/*
...
...
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