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
9d67aace
Commit
9d67aace
authored
Aug 02, 2006
by
jimw@rama.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge rama.(none):/home/jimw/my/mysql-5.0-19147
into rama.(none):/home/jimw/my/mysql-5.0-16502
parents
41956bee
dc0f4a21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
2 deletions
+83
-2
client/mysqlshow.c
client/mysqlshow.c
+25
-2
mysql-test/r/mysqlshow.result
mysql-test/r/mysqlshow.result
+49
-0
mysql-test/t/mysqlshow.test
mysql-test/t/mysqlshow.test
+9
-0
No files found.
client/mysqlshow.c
View file @
9d67aace
...
@@ -344,7 +344,7 @@ list_dbs(MYSQL *mysql,const char *wild)
...
@@ -344,7 +344,7 @@ list_dbs(MYSQL *mysql,const char *wild)
char
query
[
255
];
char
query
[
255
];
MYSQL_FIELD
*
field
;
MYSQL_FIELD
*
field
;
MYSQL_RES
*
result
;
MYSQL_RES
*
result
;
MYSQL_ROW
row
,
rrow
;
MYSQL_ROW
row
=
NULL
,
rrow
;
if
(
!
(
result
=
mysql_list_dbs
(
mysql
,
wild
)))
if
(
!
(
result
=
mysql_list_dbs
(
mysql
,
wild
)))
{
{
...
@@ -352,6 +352,26 @@ list_dbs(MYSQL *mysql,const char *wild)
...
@@ -352,6 +352,26 @@ list_dbs(MYSQL *mysql,const char *wild)
mysql_error
(
mysql
));
mysql_error
(
mysql
));
return
1
;
return
1
;
}
}
/*
If a wildcard was used, but there was only one row and it's name is an
exact match, we'll assume they really wanted to see the contents of that
database. This is because it is fairly common for database names to
contain the underscore (_), like INFORMATION_SCHEMA.
*/
if
(
wild
&&
mysql_num_rows
(
result
)
==
1
)
{
row
=
mysql_fetch_row
(
result
);
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
row
[
0
],
wild
))
{
mysql_free_result
(
result
);
if
(
opt_status
)
return
list_table_status
(
mysql
,
wild
,
NULL
);
else
return
list_tables
(
mysql
,
wild
,
NULL
);
}
}
if
(
wild
)
if
(
wild
)
printf
(
"Wildcard: %s
\n
"
,
wild
);
printf
(
"Wildcard: %s
\n
"
,
wild
);
...
@@ -368,7 +388,8 @@ list_dbs(MYSQL *mysql,const char *wild)
...
@@ -368,7 +388,8 @@ list_dbs(MYSQL *mysql,const char *wild)
else
else
print_header
(
header
,
length
,
"Tables"
,
6
,
"Total Rows"
,
12
,
NullS
);
print_header
(
header
,
length
,
"Tables"
,
6
,
"Total Rows"
,
12
,
NullS
);
while
((
row
=
mysql_fetch_row
(
result
)))
/* The first row may have already been read up above. */
while
(
row
||
(
row
=
mysql_fetch_row
(
result
)))
{
{
counter
++
;
counter
++
;
...
@@ -422,6 +443,8 @@ list_dbs(MYSQL *mysql,const char *wild)
...
@@ -422,6 +443,8 @@ list_dbs(MYSQL *mysql,const char *wild)
print_row
(
row
[
0
],
length
,
tables
,
6
,
NullS
);
print_row
(
row
[
0
],
length
,
tables
,
6
,
NullS
);
else
else
print_row
(
row
[
0
],
length
,
tables
,
6
,
rows
,
12
,
NullS
);
print_row
(
row
[
0
],
length
,
tables
,
6
,
rows
,
12
,
NullS
);
row
=
NULL
;
}
}
print_trailer
(
length
,
print_trailer
(
length
,
...
...
mysql-test/r/mysqlshow.result
View file @
9d67aace
...
@@ -75,3 +75,52 @@ Database: test
...
@@ -75,3 +75,52 @@ Database: test
2 rows in set.
2 rows in set.
DROP TABLE t1, t2;
DROP TABLE t1, t2;
Database: information_schema
+---------------------------------------+
| Tables |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| KEY_COLUMN_USAGE |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
| Tables |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| KEY_COLUMN_USAGE |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
| Databases |
+--------------------+
| information_schema |
+--------------------+
End of 5.0 tests
mysql-test/t/mysqlshow.test
View file @
9d67aace
...
@@ -25,3 +25,12 @@ select "---- -v -t ---------" as "";
...
@@ -25,3 +25,12 @@ select "---- -v -t ---------" as "";
select
"---- -v -v -t ------"
as
""
;
select
"---- -v -v -t ------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
v
-
v
-
t
--
exec
$MYSQL_SHOW
test
-
v
-
v
-
t
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
#
--
exec
$MYSQL_SHOW
information_schema
--
exec
$MYSQL_SHOW
INFORMATION_SCHEMA
--
exec
$MYSQL_SHOW
inf_rmation_schema
--
echo
End
of
5.0
tests
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