Commit 2d108230 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

SHOW [FULL] COLUMNS

Added timeouts to replication tests to handle concurrent inserts
parent 0f28f7a4
...@@ -20129,7 +20129,7 @@ commands to examine and kill threads. ...@@ -20129,7 +20129,7 @@ commands to examine and kill threads.
@example @example
SHOW DATABASES [LIKE wild] SHOW DATABASES [LIKE wild]
or SHOW [OPEN] TABLES [FROM db_name] [LIKE wild] or SHOW [OPEN] TABLES [FROM db_name] [LIKE wild]
or SHOW COLUMNS FROM tbl_name [FROM db_name] [LIKE wild] or SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE wild]
or SHOW INDEX FROM tbl_name [FROM db_name] or SHOW INDEX FROM tbl_name [FROM db_name]
or SHOW TABLE STATUS [FROM db_name] [LIKE wild] or SHOW TABLE STATUS [FROM db_name] [LIKE wild]
or SHOW STATUS [LIKE wild] or SHOW STATUS [LIKE wild]
...@@ -20188,10 +20188,11 @@ db_name}. ...@@ -20188,10 +20188,11 @@ db_name}.
the table cache. @xref{Table cache}. The @code{Comment} field tells the table cache. @xref{Table cache}. The @code{Comment} field tells
how many times the table is @code{cached} and @code{in_use}. how many times the table is @code{cached} and @code{in_use}.
@code{SHOW COLUMNS} lists the columns in a given table. If the column @code{SHOW COLUMNS} lists the columns in a given table. If you specify
types are different than you expect them to be based on a @code{CREATE the @code{FULL} option, you will also get the privileges you have for
TABLE} statement, note that @strong{MySQL} sometimes changes column each column. If the column types are different than you expect them to
types. @xref{Silent column changes}. be based on a @code{CREATE TABLE} statement, note that @strong{MySQL}
sometimes changes column types. @xref{Silent column changes}.
The @code{DESCRIBE} statement provides information similar to The @code{DESCRIBE} statement provides information similar to
@code{SHOW COLUMNS}. @code{SHOW COLUMNS}.
...@@ -40712,6 +40713,9 @@ not yet 100 % confident in this code. ...@@ -40712,6 +40713,9 @@ not yet 100 % confident in this code.
@appendixsubsec Changes in release 3.23.32 @appendixsubsec Changes in release 3.23.32
@itemize @bullet @itemize @bullet
@item @item
Added option @code{FULL} to @code{SHOW COLUMNS}. Now we only show the
privilege list for the columns if this option is given.
@item
Fixed bug in @code{SHOW LOGS} when there wheren't any BDB logs. Fixed bug in @code{SHOW LOGS} when there wheren't any BDB logs.
@item @item
Fixed a timing problem in replication that could delay sending an update Fixed a timing problem in replication that could delay sending an update
...@@ -397,7 +397,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, ...@@ -397,7 +397,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_error(mysql)); mysql_error(mysql));
return 1; return 1;
} }
end=strmov(strmov(query,"show columns from "),table); end=strmov(strmov(query,"show /*!32332 FULL */ columns from "),table);
if (wild && wild[0]) if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS); strxmov(end," like '",wild,"'",NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
......
...@@ -12,6 +12,14 @@ test.t1 check status OK ...@@ -12,6 +12,14 @@ test.t1 check status OK
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK test.t1 check status OK
Field Type Null Key Default Extra
a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
Field Type Null Key Default Extra Privileges
a int(11) PRI 0 select,insert,update,references
b int(11) MUL 0 select,insert,update,references
c int(11) 0 select,insert,update,references
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 4 NULL NULL t1 0 PRIMARY 1 a A 4 NULL NULL
t1 1 b 1 b A 1 NULL NULL t1 1 b 1 b A 1 NULL NULL
......
...@@ -34,7 +34,7 @@ PRIMARY KEY (GROUP_ID,LANG_ID), ...@@ -34,7 +34,7 @@ PRIMARY KEY (GROUP_ID,LANG_ID),
KEY NAME (NAME)); KEY NAME (NAME));
#show table status like "t1"; #show table status like "t1";
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null; ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
SHOW COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
......
...@@ -12,6 +12,7 @@ insert into foo values(1),(2); ...@@ -12,6 +12,7 @@ insert into foo values(1),(2);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
use test; use test;
select * from foo; select * from foo;
select sum(length(word)) from t1; select sum(length(word)) from t1;
......
...@@ -9,6 +9,7 @@ save_master_pos; ...@@ -9,6 +9,7 @@ save_master_pos;
connection slave; connection slave;
use test; use test;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000002.result select * from t1; @r/rpl000002.result select * from t1;
connection master; connection master;
drop table t1; drop table t1;
......
...@@ -7,6 +7,7 @@ insert into t1 values (3); ...@@ -7,6 +7,7 @@ insert into t1 values (3);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000003.result select * from t1; @r/rpl000003.result select * from t1;
connection master; connection master;
drop table t1; drop table t1;
......
...@@ -18,6 +18,7 @@ insert into bar values(15); ...@@ -18,6 +18,7 @@ insert into bar values(15);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000007.result select foo.n,bar.m from foo,bar; @r/rpl000007.result select foo.n,bar.m from foo,bar;
connection master; connection master;
drop table if exists bar,foo; drop table if exists bar,foo;
......
...@@ -20,6 +20,7 @@ insert into choo values(55); ...@@ -20,6 +20,7 @@ insert into choo values(55);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo; @r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo;
connection master; connection master;
drop table if exists foo,bar,choo; drop table if exists foo,bar,choo;
......
...@@ -22,6 +22,7 @@ insert into bar.bar values(15); ...@@ -22,6 +22,7 @@ insert into bar.bar values(15);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000009.result select foo.foo.n,bar.bar.m from foo.foo,bar.bar; @r/rpl000009.result select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
connection master; connection master;
drop database if exists bar; drop database if exists bar;
......
...@@ -11,6 +11,7 @@ insert into t1 values(2); ...@@ -11,6 +11,7 @@ insert into t1 values(2);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000010.result select n from t1; @r/rpl000010.result select n from t1;
connection master; connection master;
drop table t1; drop table t1;
......
...@@ -16,6 +16,7 @@ save_master_pos; ...@@ -16,6 +16,7 @@ save_master_pos;
connection slave; connection slave;
#let slave catch up #let slave catch up
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000011.result select * from t1; @r/rpl000011.result select * from t1;
connection master; connection master;
drop table t1; drop table t1;
......
...@@ -19,6 +19,7 @@ connection master2; ...@@ -19,6 +19,7 @@ connection master2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000012.result select * from t2; @r/rpl000012.result select * from t2;
@r/rpl000012.status.result show status like 'Slave_open_temp_tables'; @r/rpl000012.status.result show status like 'Slave_open_temp_tables';
# #
......
...@@ -22,6 +22,7 @@ connection master2; ...@@ -22,6 +22,7 @@ connection master2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
@r/rpl000013.result select * from t2; @r/rpl000013.result select * from t2;
@r/rpl000013.status.result show status like 'Slave_open_temp_tables'; @r/rpl000013.status.result show status like 'Slave_open_temp_tables';
# #
......
...@@ -24,6 +24,7 @@ save_master_pos; ...@@ -24,6 +24,7 @@ save_master_pos;
connection slave; connection slave;
change master to master_log_pos=73; change master to master_log_pos=73;
sync_with_master; sync_with_master;
sleep 1;
select * from foo; select * from foo;
connection master; connection master;
drop table foo; drop table foo;
......
...@@ -21,6 +21,7 @@ insert into foo values (10),(45),(90); ...@@ -21,6 +21,7 @@ insert into foo values (10),(45),(90);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
select * from foo; select * from foo;
connection master; connection master;
drop table foo; drop table foo;
......
...@@ -18,6 +18,7 @@ insert into t1 values('Could not break slave'),('Tried hard'); ...@@ -18,6 +18,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
select * from t1; select * from t1;
connection master; connection master;
flush logs; flush logs;
...@@ -32,6 +33,7 @@ insert into t2 values (65); ...@@ -32,6 +33,7 @@ insert into t2 values (65);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
sleep 1;
select * from t2; select * from t2;
drop table if exists t1,t2; drop table if exists t1,t2;
connection master; connection master;
......
...@@ -1705,9 +1705,9 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1; ...@@ -1705,9 +1705,9 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
show tables; show tables;
show tables from test like "s%"; show tables from test like "s%";
show tables from test like "t?"; show tables from test like "t?";
show columns from t2; show full columns from t2;
show columns from t2 from test like 'f%'; show full columns from t2 from test like 'f%';
show columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
show keys from t2; show keys from t2;
# #
......
...@@ -11,6 +11,8 @@ repair table t1,t2; ...@@ -11,6 +11,8 @@ repair table t1,t2;
check table t2,t1; check table t2,t1;
lock tables t1 read; lock tables t1 read;
check table t2,t1; check table t2,t1;
show columns from t1;
show full columns from t1;
show keys from t1; show keys from t1;
drop table t1,t2; drop table t1,t2;
......
...@@ -37,9 +37,9 @@ insert into t1 values (NULL,NULL,NULL,NULL); ...@@ -37,9 +37,9 @@ insert into t1 values (NULL,NULL,NULL,NULL);
update t1 set c="",b=null where c="1"; update t1 set c="",b=null where c="1";
lock tables t1 READ; lock tables t1 READ;
show fields from t1; show full fields from t1;
lock tables t1 WRITE; lock tables t1 WRITE;
show fields from t1; show full fields from t1;
unlock tables; unlock tables;
select t from t1 where t like "hello"; select t from t1 where t like "hello";
......
...@@ -7,7 +7,7 @@ select 6e-05, -6e-05, --6e-05, -6e-05+1.000000; ...@@ -7,7 +7,7 @@ select 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
drop table if exists t1; drop table if exists t1;
create table t1 (f1 float(24),f2 float(52)); create table t1 (f1 float(24),f2 float(52));
show columns from t1; show full columns from t1;
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1; select * from t1;
...@@ -32,7 +32,7 @@ drop table t1; ...@@ -32,7 +32,7 @@ drop table t1;
# #
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show columns from t1; show full columns from t1;
drop table t1; drop table t1;
create table t1 (a decimal(7,3) not null, key (a)); create table t1 (a decimal(7,3) not null, key (a));
......
...@@ -43,7 +43,7 @@ CREATE TABLE t1 ( ...@@ -43,7 +43,7 @@ CREATE TABLE t1 (
KEY (options,flags) KEY (options,flags)
); );
show fields from t1; show full fields from t1;
show keys from t1; show keys from t1;
CREATE UNIQUE INDEX test on t1 ( auto ) ; CREATE UNIQUE INDEX test on t1 ( auto ) ;
...@@ -117,15 +117,15 @@ drop table t2; ...@@ -117,15 +117,15 @@ drop table t2;
create table t2 select * from t1; create table t2 select * from t1;
update t2 set string="changed" where auto=16; update t2 set string="changed" where auto=16;
show columns from t1; show full columns from t1;
show columns from t2; show full columns from t2;
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field); select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
drop table t2; drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1; create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
show columns from t2; show full columns from t2;
select * from t2; select * from t2;
drop table t1,t2; drop table t1,t2;
...@@ -134,7 +134,7 @@ insert into t1 values(1),(2); ...@@ -134,7 +134,7 @@ insert into t1 values(1),(2);
create table t2 select * from t1; create table t2 select * from t1;
!$1060 create table t3 select * from t1, t2; # Should give an error !$1060 create table t3 select * from t1, t2; # Should give an error
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2; create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show columns from t3; show full columns from t3;
drop table t1,t2,t3; drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
......
...@@ -362,7 +362,8 @@ int mysqld_show_dbs(THD *thd,const char *wild); ...@@ -362,7 +362,8 @@ int mysqld_show_dbs(THD *thd,const char *wild);
int mysqld_show_open_tables(THD *thd,const char *db,const char *wild); int mysqld_show_open_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_tables(THD *thd,const char *db,const char *wild); int mysqld_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild); int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild); int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
bool verbose);
int mysqld_show_keys(THD *thd, TABLE_LIST *table); int mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd); int mysqld_show_logs(THD *thd);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
......
...@@ -1545,7 +1545,8 @@ mysql_execute_command(void) ...@@ -1545,7 +1545,8 @@ mysql_execute_command(void)
if (grant_option && check_grant(thd,SELECT_ACL,tables,2)) if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
goto error; goto error;
res= mysqld_show_fields(thd,tables, res= mysqld_show_fields(thd,tables,
(lex->wild ? lex->wild->ptr() : NullS)); (lex->wild ? lex->wild->ptr() : NullS),
lex->verbose);
break; break;
} }
#endif #endif
......
...@@ -412,7 +412,8 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ...@@ -412,7 +412,8 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
***************************************************************************/ ***************************************************************************/
int int
mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild) mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
bool verbose)
{ {
TABLE *table; TABLE *table;
handler *file; handler *file;
...@@ -437,6 +438,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild) ...@@ -437,6 +438,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
field_list.push_back(new Item_empty_string("Key",3)); field_list.push_back(new Item_empty_string("Key",3));
field_list.push_back(new Item_empty_string("Default",NAME_LEN)); field_list.push_back(new Item_empty_string("Default",NAME_LEN));
field_list.push_back(new Item_empty_string("Extra",20)); field_list.push_back(new Item_empty_string("Extra",20));
if (verbose)
field_list.push_back(new Item_empty_string("Privileges",80)); field_list.push_back(new Item_empty_string("Privileges",80));
// Send first number of fields and records // Send first number of fields and records
...@@ -502,6 +504,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild) ...@@ -502,6 +504,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
end=strmov(tmp,"auto_increment"); end=strmov(tmp,"auto_increment");
net_store_data(packet,tmp,(uint) (end-tmp)); net_store_data(packet,tmp,(uint) (end-tmp));
if (verbose)
{
/* Add grant options */ /* Add grant options */
col_access= get_column_grant(thd,table_list,field) & COL_ACLS; col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
end=tmp; end=tmp;
...@@ -514,6 +518,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild) ...@@ -514,6 +518,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
} }
} }
net_store_data(packet,tmp+1,end == tmp ? 0 : (uint) (end-tmp-1)); net_store_data(packet,tmp+1,end == tmp ? 0 : (uint) (end-tmp-1));
}
if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length())) if (my_net_write(&thd->net,(char*) packet->ptr(),packet->length()))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
......
...@@ -2159,12 +2159,12 @@ show_param: ...@@ -2159,12 +2159,12 @@ show_param:
Lex->db= $3; Lex->db= $3;
Lex->options=0; Lex->options=0;
} }
| COLUMNS FROM table_ident opt_db wild | opt_full COLUMNS FROM table_ident opt_db wild
{ {
Lex->sql_command= SQLCOM_SHOW_FIELDS; Lex->sql_command= SQLCOM_SHOW_FIELDS;
if ($4) if ($5)
$3->change_db($4); $4->change_db($5);
if (!add_table_to_list($3,NULL,0)) if (!add_table_to_list($4,NULL,0))
YYABORT; YYABORT;
} }
| MASTER_SYM LOGS_SYM | MASTER_SYM LOGS_SYM
...@@ -2181,10 +2181,8 @@ show_param: ...@@ -2181,10 +2181,8 @@ show_param:
} }
| STATUS_SYM wild | STATUS_SYM wild
{ Lex->sql_command= SQLCOM_SHOW_STATUS; } { Lex->sql_command= SQLCOM_SHOW_STATUS; }
| PROCESSLIST_SYM | opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST; Lex->verbose=0; } { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
| FULL PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST; Lex->verbose=1; }
| VARIABLES wild | VARIABLES wild
{ Lex->sql_command= SQLCOM_SHOW_VARIABLES; } { Lex->sql_command= SQLCOM_SHOW_VARIABLES; }
| LOGS_SYM | LOGS_SYM
...@@ -2215,11 +2213,16 @@ wild: ...@@ -2215,11 +2213,16 @@ wild:
/* empty */ /* empty */
| LIKE text_string { Lex->wild= $2; } | LIKE text_string { Lex->wild= $2; }
opt_full:
/* empty */ { Lex->verbose=0; }
| FULL { Lex->verbose=1; }
/* A Oracle compatible synonym for show */ /* A Oracle compatible synonym for show */
describe: describe:
describe_command table_ident describe_command table_ident
{ {
Lex->wild=0; Lex->wild=0;
Lex->verbose=0;
Lex->sql_command=SQLCOM_SHOW_FIELDS; Lex->sql_command=SQLCOM_SHOW_FIELDS;
if (!add_table_to_list($2, NULL,0)) if (!add_table_to_list($2, NULL,0))
YYABORT; YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment