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
158770e3
Commit
158770e3
authored
Mar 12, 2004
by
vva@eagle.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.0
into eagle.mysql.r18.ru:/home/vva/work/BUG_2985/mysql-4.0
parents
91a85461
131fd37c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
13 deletions
+47
-13
mysql-test/r/create.result
mysql-test/r/create.result
+6
-0
mysql-test/t/create.test
mysql-test/t/create.test
+12
-0
sql/sql_db.cc
sql/sql_db.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+4
-8
sql/table.cc
sql/table.cc
+24
-4
No files found.
mysql-test/r/create.result
View file @
158770e3
...
...
@@ -216,3 +216,9 @@ a b
0 2
3 4
drop table t1;
create table `t1 `(a int);
Incorrect table name 't1 '
create database `db1 `;
Incorrect database name 'db1 '
create table t1(`a ` int);
Incorrect column name 'a '
mysql-test/t/create.test
View file @
158770e3
...
...
@@ -179,3 +179,15 @@ create table if not exists t1 select 3 as 'a',4 as 'b';
create
table
if
not
exists
t1
select
3
as
'a'
,
3
as
'b'
;
select
*
from
t1
;
drop
table
t1
;
#
# Test for Bug #2985
# "Table truncated when creating another table name with Spaces"
#
--
error
1103
create
table
`t1 `
(
a
int
);
--
error
1102
create
database
`db1 `
;
--
error
1166
;
create
table
t1
(
`a `
int
);
sql/sql_db.cc
View file @
158770e3
...
...
@@ -381,7 +381,7 @@ bool mysql_change_db(THD *thd,const char *name)
ulong
db_access
;
DBUG_ENTER
(
"mysql_change_db"
);
if
(
!
dbname
||
!
(
db_length
=
strip_sp
(
dbname
)))
if
(
!
dbname
||
!
(
db_length
=
strlength
(
dbname
)))
{
x_free
(
dbname
);
/* purecov: inspected */
send_error
(
&
thd
->
net
,
ER_NO_DB_ERROR
);
/* purecov: inspected */
...
...
sql/sql_parse.cc
View file @
158770e3
...
...
@@ -1133,8 +1133,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment
(
com_stat
[
SQLCOM_CREATE_DB
],
&
LOCK_status
);
// null test to handle EOM
if
(
!
db
||
!
strip_sp
(
db
)
||
!
(
alias
=
thd
->
strdup
(
db
))
||
check_db_name
(
db
))
if
(
!
db
||
!
(
alias
=
thd
->
strdup
(
db
))
||
check_db_name
(
db
))
{
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
break
;
...
...
@@ -1150,8 +1149,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment
(
com_stat
[
SQLCOM_DROP_DB
],
&
LOCK_status
);
char
*
db
=
thd
->
strdup
(
packet
),
*
alias
;
// null test to handle EOM
if
(
!
db
||
!
strip_sp
(
db
)
||
!
(
alias
=
thd
->
strdup
(
db
))
||
check_db_name
(
db
))
if
(
!
db
||
!
(
alias
=
thd
->
strdup
(
db
))
||
check_db_name
(
db
))
{
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
db
?
db
:
"NULL"
);
break
;
...
...
@@ -2332,8 +2330,7 @@ mysql_execute_command(void)
case
SQLCOM_CREATE_DB
:
{
char
*
alias
;
if
(
!
strip_sp
(
lex
->
name
)
||
!
(
alias
=
thd
->
strdup
(
lex
->
name
))
||
check_db_name
(
lex
->
name
))
if
(
!
(
alias
=
thd
->
strdup
(
lex
->
name
))
||
check_db_name
(
lex
->
name
))
{
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
break
;
...
...
@@ -2362,8 +2359,7 @@ mysql_execute_command(void)
case
SQLCOM_DROP_DB
:
{
char
*
alias
;
if
(
!
strip_sp
(
lex
->
name
)
||
!
(
alias
=
thd
->
strdup
(
lex
->
name
))
||
check_db_name
(
lex
->
name
))
if
(
!
(
alias
=
thd
->
strdup
(
lex
->
name
))
||
check_db_name
(
lex
->
name
))
{
net_printf
(
&
thd
->
net
,
ER_WRONG_DB_NAME
,
lex
->
name
);
break
;
...
...
sql/table.cc
View file @
158770e3
...
...
@@ -1140,7 +1140,8 @@ char *get_field(MEM_ROOT *mem, TABLE *table, uint fieldnr)
bool
check_db_name
(
char
*
name
)
{
char
*
start
=
name
;
char
*
start
=
name
;
bool
last_char_is_space
=
FALSE
;
if
(
lower_case_table_names
)
casedn_str
(
name
);
...
...
@@ -1148,6 +1149,7 @@ bool check_db_name(char *name)
while
(
*
name
)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
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
);
...
...
@@ -1157,19 +1159,22 @@ bool check_db_name(char *name)
continue
;
}
}
#else
last_char_is_space
=
*
name
==
' '
;
#endif
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
*
name
==
FN_EXTCHAR
)
return
1
;
name
++
;
}
return
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
return
last_char_is_space
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
}
/*
Allow anything as a table name, as long as it doesn't contain an
a '/', or a '.' character
or ' ' at the end
returns 1 on error
*/
...
...
@@ -1179,10 +1184,17 @@ bool check_table_name(const char *name, uint length)
const
char
*
end
=
name
+
length
;
if
(
!
length
||
length
>
NAME_LEN
)
return
1
;
#if defined(USE_MB) && defined(USE_MB_IDENT)
bool
last_char_is_space
=
FALSE
;
#else
if
(
name
[
length
-
1
]
==
' '
)
return
1
;
#endif
while
(
name
!=
end
)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
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
);
...
...
@@ -1197,16 +1209,22 @@ bool check_table_name(const char *name, uint length)
return
1
;
name
++
;
}
#if defined(USE_MB) && defined(USE_MB_IDENT)
return
last_char_is_space
;
#else
return
0
;
#endif
}
bool
check_column_name
(
const
char
*
name
)
{
const
char
*
start
=
name
;
bool
last_char_is_space
=
false
;
while
(
*
name
)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
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
);
...
...
@@ -1216,13 +1234,15 @@ bool check_column_name(const char *name)
continue
;
}
}
#else
last_char_is_space
=
*
name
==
' '
;
#endif
if
(
*
name
==
NAMES_SEP_CHAR
)
return
1
;
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