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
903d1b6b
Commit
903d1b6b
authored
Mar 23, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
parents
e3164272
47a1612d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
170 additions
and
18 deletions
+170
-18
client/mysqlshow.c
client/mysqlshow.c
+62
-16
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+12
-2
mysql-test/r/mysqlshow.result
mysql-test/r/mysqlshow.result
+76
-0
mysql-test/t/mysqlshow.test
mysql-test/t/mysqlshow.test
+20
-0
No files found.
client/mysqlshow.c
View file @
903d1b6b
...
...
@@ -28,7 +28,8 @@
#include <sslopt-vars.h>
static
my_string
host
=
0
,
opt_password
=
0
,
user
=
0
;
static
my_bool
opt_show_keys
=
0
,
opt_compress
=
0
,
opt_status
=
0
,
tty_password
=
0
;
static
my_bool
opt_show_keys
=
0
,
opt_compress
=
0
,
opt_status
=
0
,
tty_password
=
0
,
opt_table_type
=
0
;
static
uint
opt_verbose
=
0
;
static
char
*
default_charset
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
;
...
...
@@ -193,6 +194,9 @@ static struct my_option my_long_options[] =
"Base name of shared memory."
,
(
gptr
*
)
&
shared_memory_base_name
,
(
gptr
*
)
&
shared_memory_base_name
,
0
,
GET_STR_ALLOC
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#endif
{
"show-table-type"
,
't'
,
"Show table type column."
,
(
gptr
*
)
&
opt_table_type
,
(
gptr
*
)
&
opt_table_type
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"socket"
,
'S'
,
"Socket file to use for connection."
,
(
gptr
*
)
&
opt_mysql_unix_port
,
(
gptr
*
)
&
opt_mysql_unix_port
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
...
@@ -418,7 +422,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
{
const
char
*
header
;
uint
head_length
,
counter
=
0
;
char
query
[
255
],
rows
[
64
],
fields
[
16
];
char
query
[
255
],
rows
[
NAME_LEN
],
fields
[
16
];
MYSQL_FIELD
*
field
;
MYSQL_RES
*
result
;
MYSQL_ROW
row
,
rrow
;
...
...
@@ -429,7 +433,20 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
mysql_error
(
mysql
));
return
1
;
}
if
(
!
(
result
=
mysql_list_tables
(
mysql
,
table
)))
if
(
table
)
{
/*
We just hijack the 'rows' variable for a bit to store the escaped
table name
*/
mysql_escape_string
(
rows
,
table
,
sizeof
(
rows
));
my_snprintf
(
query
,
sizeof
(
query
),
"show%s tables like '%s'"
,
opt_table_type
?
" full"
:
""
,
rows
);
}
else
my_snprintf
(
query
,
sizeof
(
query
),
"show%s tables"
,
opt_table_type
?
" full"
:
""
);
if
(
mysql_query
(
mysql
,
query
)
||
!
(
result
=
mysql_store_result
(
mysql
)))
{
fprintf
(
stderr
,
"%s: Cannot list tables in %s: %s
\n
"
,
my_progname
,
db
,
mysql_error
(
mysql
));
...
...
@@ -446,12 +463,27 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
if
(
head_length
<
field
->
max_length
)
head_length
=
field
->
max_length
;
if
(
opt_table_type
)
{
if
(
!
opt_verbose
)
print_header
(
header
,
head_length
,
"table_type"
,
10
,
NullS
);
else
if
(
opt_verbose
==
1
)
print_header
(
header
,
head_length
,
"table_type"
,
10
,
"Columns"
,
8
,
NullS
);
else
{
print_header
(
header
,
head_length
,
"table_type"
,
10
,
"Columns"
,
8
,
"Total Rows"
,
10
,
NullS
);
}
}
else
{
if
(
!
opt_verbose
)
print_header
(
header
,
head_length
,
NullS
);
else
if
(
opt_verbose
==
1
)
print_header
(
header
,
head_length
,
"Columns"
,
8
,
NullS
);
else
print_header
(
header
,
head_length
,
"Columns"
,
8
,
"Total Rows"
,
10
,
NullS
);
}
while
((
row
=
mysql_fetch_row
(
result
)))
{
...
...
@@ -500,6 +532,17 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
strmov
(
rows
,
"N/A"
);
}
}
if
(
opt_table_type
)
{
if
(
!
opt_verbose
)
print_row
(
row
[
0
],
head_length
,
row
[
1
],
10
,
NullS
);
else
if
(
opt_verbose
==
1
)
print_row
(
row
[
0
],
head_length
,
row
[
1
],
10
,
fields
,
8
,
NullS
);
else
print_row
(
row
[
0
],
head_length
,
row
[
1
],
10
,
fields
,
8
,
rows
,
10
,
NullS
);
}
else
{
if
(
!
opt_verbose
)
print_row
(
row
[
0
],
head_length
,
NullS
);
else
if
(
opt_verbose
==
1
)
...
...
@@ -507,10 +550,13 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
else
print_row
(
row
[
0
],
head_length
,
fields
,
8
,
rows
,
10
,
NullS
);
}
}
print_trailer
(
head_length
,
(
opt_verbose
>
0
?
8
:
0
),
(
opt_verbose
>
1
?
10
:
0
),
(
opt_table_type
?
10
:
opt_verbose
>
0
?
8
:
0
),
(
opt_table_type
?
(
opt_verbose
>
0
?
8
:
0
)
:
(
opt_verbose
>
1
?
10
:
0
)),
!
opt_table_type
?
0
:
opt_verbose
>
1
?
10
:
0
,
0
);
if
(
counter
&&
opt_verbose
)
...
...
mysql-test/mysql-test-run.sh
View file @
903d1b6b
...
...
@@ -222,6 +222,7 @@ FAILED_CASES=
EXTRA_MASTER_OPT
=
""
EXTRA_MYSQL_TEST_OPT
=
""
EXTRA_MYSQLDUMP_OPT
=
""
EXTRA_MYSQLSHOW_OPT
=
""
EXTRA_MYSQLBINLOG_OPT
=
""
USE_RUNNING_SERVER
=
0
USE_NDBCLUSTER
=
@USE_NDBCLUSTER@
...
...
@@ -453,6 +454,8 @@ while test $# -gt 0; do
--debug=d:t:A,
$MYSQL_TEST_DIR
/var/log/mysqltest.trace"
EXTRA_MYSQLDUMP_OPT
=
"
$EXTRA_MYSQLDUMP_OPT
\
--debug=d:t:A,
$MYSQL_TEST_DIR
/var/log/mysqldump.trace"
EXTRA_MYSQLSHOW_OPT
=
"
$EXTRA_MYSQLSHOW_OPT
\
--debug=d:t:A,
$MYSQL_TEST_DIR
/var/log/mysqlshow.trace"
EXTRA_MYSQLBINLOG_OPT
=
"
$EXTRA_MYSQLBINLOG_OPT
\
--debug=d:t:A,
$MYSQL_TEST_DIR
/var/log/mysqlbinlog.trace"
EXTRA_MYSQL_CLIENT_TEST_OPT
=
"--debug=d:t:A,
$MYSQL_TEST_DIR
/var/log/mysql_client_test.trace"
...
...
@@ -556,6 +559,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_DUMP
=
"
$BASEDIR
/client/mysqldump"
fi
if
[
-f
"
$BASEDIR
/client/.libs/mysqlshow"
]
;
then
MYSQL_SHOW
=
"
$BASEDIR
/client/.libs/mysqlshow"
else
MYSQL_SHOW
=
"
$BASEDIR
/client/mysqlshow"
fi
if
[
-f
"
$BASEDIR
/client/.libs/mysqlbinlog"
]
;
then
MYSQL_BINLOG
=
"
$BASEDIR
/client/.libs/mysqlbinlog"
else
...
...
@@ -627,6 +635,7 @@ else
fi
MYSQL_TEST
=
"
$CLIENT_BINDIR
/mysqltest"
MYSQL_DUMP
=
"
$CLIENT_BINDIR
/mysqldump"
MYSQL_SHOW
=
"
$CLIENT_BINDIR
/mysqlshow"
MYSQL_BINLOG
=
"
$CLIENT_BINDIR
/mysqlbinlog"
MYSQLADMIN
=
"
$CLIENT_BINDIR
/mysqladmin"
WAIT_PID
=
"
$CLIENT_BINDIR
/mysql_waitpid"
...
...
@@ -697,10 +706,11 @@ fi
MYSQL_CLIENT_TEST
=
"
$MYSQL_CLIENT_TEST
--no-defaults --testcase --user=root --socket=
$MASTER_MYSOCK
--port=
$MYSQL_TCP_PORT
--silent
$EXTRA_MYSQL_CLIENT_TEST_OPT
"
MYSQL_DUMP
=
"
$MYSQL_DUMP
--no-defaults -uroot --socket=
$MASTER_MYSOCK
--password=
$DBPASSWD
$EXTRA_MYSQLDUMP_OPT
"
MYSQL_SHOW
=
"
$MYSQL_SHOW
-uroot --socket=
$MASTER_MYSOCK
--password=
$DBPASSWD
$EXTRA_MYSQLSHOW_OPT
"
MYSQL_BINLOG
=
"
$MYSQL_BINLOG
--no-defaults --local-load=
$MYSQL_TMP_DIR
--character-sets-dir=
$CHARSETSDIR
$EXTRA_MYSQLBINLOG_OPT
"
MYSQL_FIX_SYSTEM_TABLES
=
"
$MYSQL_FIX_SYSTEM_TABLES
--no-defaults --host=localhost --port=
$MASTER_MYPORT
--socket=
$MASTER_MYSOCK
--user=root --password=
$DBPASSWD
--basedir=
$BASEDIR
--bindir=
$CLIENT_BINDIR
--verbose"
MYSQL
=
"
$MYSQL
--host=localhost --port=
$MASTER_MYPORT
--socket=
$MASTER_MYSOCK
--user=root --password=
$DBPASSWD
"
export
MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
export
MYSQL MYSQL_DUMP MYSQL_
SHOW MYSQL_
BINLOG MYSQL_FIX_SYSTEM_TABLES
export
CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
export
NDB_TOOLS_DIR
export
NDB_MGM
...
...
@@ -731,7 +741,7 @@ if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
XTERM
=
`
which xterm
`
fi
export
MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
export
MYSQL MYSQL_DUMP MYSQL_
SHOW MYSQL_
BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
#++
# Function Definitions
...
...
mysql-test/r/mysqlshow.result
0 → 100644
View file @
903d1b6b
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (a int, b int);
show tables;
Tables_in_test
t1
t2
select "--------------------" as "";
--------------------
Database: test
+--------+
| Tables |
+--------+
| t1 |
| t2 |
+--------+
select "---- -v ------------" as "";
---- -v ------------
Database: test
+--------+----------+
| Tables | Columns |
+--------+----------+
| t1 | 1 |
| t2 | 2 |
+--------+----------+
2 rows in set.
select "---- -v -v ---------" as "";
---- -v -v ---------
Database: test
+--------+----------+------------+
| Tables | Columns | Total Rows |
+--------+----------+------------+
| t1 | 1 | 3 |
| t2 | 2 | 0 |
+--------+----------+------------+
2 rows in set.
select "----- -t -----------" as "";
----- -t -----------
Database: test
+--------+------------+
| Tables | table_type |
+--------+------------+
| t1 | BASE TABLE |
| t2 | BASE TABLE |
+--------+------------+
select "---- -v -t ---------" as "";
---- -v -t ---------
Database: test
+--------+------------+----------+
| Tables | table_type | Columns |
+--------+------------+----------+
| t1 | BASE TABLE | 1 |
| t2 | BASE TABLE | 2 |
+--------+------------+----------+
2 rows in set.
select "---- -v -v -t ------" as "";
---- -v -v -t ------
Database: test
+--------+------------+----------+------------+
| Tables | table_type | Columns | Total Rows |
+--------+------------+----------+------------+
| t1 | BASE TABLE | 1 | 3 |
| t2 | BASE TABLE | 2 | 0 |
+--------+------------+----------+------------+
2 rows in set.
DROP TABLE t1, t2;
mysql-test/t/mysqlshow.test
0 → 100644
View file @
903d1b6b
#
## Bug #5036 mysqlshow is missing a column
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
CREATE
TABLE
t2
(
a
int
,
b
int
);
show
tables
;
select
"--------------------"
as
""
;
--
exec
$MYSQL_SHOW
test
select
"---- -v ------------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
v
select
"---- -v -v ---------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
v
-
v
select
"----- -t -----------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
t
select
"---- -v -t ---------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
v
-
t
select
"---- -v -v -t ------"
as
""
;
--
exec
$MYSQL_SHOW
test
-
v
-
v
-
t
DROP
TABLE
t1
,
t2
;
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