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
ea61b788
Commit
ea61b788
authored
Jan 14, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
parents
7b652e9a
f1c7527b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
7 deletions
+43
-7
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+21
-4
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+7
-2
sql/sql_show.cc
sql/sql_show.cc
+15
-1
No files found.
mysql-test/r/show_check.result
View file @
ea61b788
...
@@ -88,20 +88,37 @@ drop table t2;
...
@@ -88,20 +88,37 @@ drop table t2;
create table t1 (
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien' comment 'O''Brien as default',
name char(20) default 'O''Brien' comment 'O''Brien as default',
c int not null comment 'int column'
c int not null comment 'int column',
) comment = 'it\'s a table' ;
`c-b` int comment 'name with a space',
show create table t1 ;
`space ` int comment 'name with a space',
) comment = 'it\'s a table' ;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL default '0' COMMENT 'int column'
`c` int(11) NOT NULL default '0' COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a space',
`space ` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=0;
show create table t1;
Table Create Table
t1 CREATE TABLE t1 (
test_set set('val1','val2','val3') NOT NULL default '',
name char(20) default 'O''Brien' COMMENT 'O''Brien as default',
c int(11) NOT NULL default '0' COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a space',
`space ` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=1;
show full columns from t1;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) NULL 0 select,insert,update,references int column
c int(11) NULL 0 select,insert,update,references int column
c-b int(11) NULL YES NULL select,insert,update,references name with a space
space int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1;
drop table t1;
create table t1 (a int not null, unique aa (a));
create table t1 (a int not null, unique aa (a));
show create table t1;
show create table t1;
...
...
mysql-test/t/show_check.test
View file @
ea61b788
...
@@ -53,9 +53,14 @@ drop table t2;
...
@@ -53,9 +53,14 @@ drop table t2;
create
table
t1
(
create
table
t1
(
test_set
set
(
'val1'
,
'val2'
,
'val3'
)
not
null
default
''
,
test_set
set
(
'val1'
,
'val2'
,
'val3'
)
not
null
default
''
,
name
char
(
20
)
default
'O''Brien'
comment
'O''Brien as default'
,
name
char
(
20
)
default
'O''Brien'
comment
'O''Brien as default'
,
c
int
not
null
comment
'int column'
c
int
not
null
comment
'int column'
,
`c-b`
int
comment
'name with a space'
,
`space `
int
comment
'name with a space'
,
)
comment
=
'it\'s a table'
;
)
comment
=
'it\'s a table'
;
show
create
table
t1
;
show
create
table
t1
;
set
sql_quote_show_create
=
0
;
show
create
table
t1
;
set
sql_quote_show_create
=
1
;
show
full
columns
from
t1
;
show
full
columns
from
t1
;
drop
table
t1
;
drop
table
t1
;
...
...
sql/sql_show.cc
View file @
ea61b788
...
@@ -997,6 +997,19 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
...
@@ -997,6 +997,19 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
/* possible TODO: call find_keyword() from sql_lex.cc here */
static
bool
require_quotes
(
const
char
*
name
,
uint
length
)
{
uint
i
,
d
,
c
;
for
(
i
=
0
;
i
<
length
;
i
+=
d
)
{
c
=
((
uchar
*
)
name
)[
i
];
d
=
my_mbcharlen
(
system_charset_info
,
c
);
if
(
d
==
1
&&
!
system_charset_info
->
ident_map
[
c
])
return
1
;
}
return
0
;
}
void
void
append_identifier
(
THD
*
thd
,
String
*
packet
,
const
char
*
name
,
uint
length
)
append_identifier
(
THD
*
thd
,
String
*
packet
,
const
char
*
name
,
uint
length
)
...
@@ -1007,7 +1020,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
...
@@ -1007,7 +1020,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
else
else
qtype
=
'`'
;
qtype
=
'`'
;
if
(
thd
->
options
&
OPTION_QUOTE_SHOW_CREATE
)
if
((
thd
->
options
&
OPTION_QUOTE_SHOW_CREATE
)
||
require_quotes
(
name
,
length
))
{
{
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
&
qtype
,
1
);
packet
->
append
(
name
,
length
,
system_charset_info
);
packet
->
append
(
name
,
length
,
system_charset_info
);
...
...
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