1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

wl#1629 SHOW with WHERE(final part, after review)

added syntax:
  'show variables where', 'show status where', 'show open tables where'


mysql-test/r/grant_cache.result:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/information_schema.result:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/query_cache.result:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/temp_table.result:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/union.result:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/t/information_schema.test:
  wl#1629 SHOW with WHERE(final part,after review)
mysql-test/t/query_cache.test:
  wl#1629 SHOW with WHERE(final part,after review)
sql/item.cc:
  wl#1629 SHOW with WHERE(final part,after review)
sql/mysql_priv.h:
  wl#1629 SHOW with WHERE(final part,after review)
sql/sql_parse.cc:
  wl#1629 SHOW with WHERE(final part,after review)
sql/sql_select.cc:
  wl#1629 SHOW with WHERE(final part,after review)
sql/sql_show.cc:
  wl#1629 SHOW with WHERE(final part,after review)
sql/sql_yacc.yy:
  wl#1629 SHOW with WHERE(final part,after review)
sql/table.h:
  wl#1629 SHOW with WHERE(final part,after review)
This commit is contained in:
unknown
2004-12-30 15:20:40 +03:00
parent 499deb9c44
commit 525242d37f
14 changed files with 202 additions and 306 deletions

View File

@ -59,7 +59,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 0
Qcache_not_cached 5
select "user1";
user1
user1
@ -71,7 +71,7 @@ Variable_name Value
Qcache_hits 0
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
Qcache_not_cached 9
select * from t1;
a b c
1 1 1
@ -84,7 +84,7 @@ Variable_name Value
Qcache_hits 1
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
Qcache_not_cached 12
select a from t1 ;
a
1
@ -97,7 +97,7 @@ Variable_name Value
Qcache_hits 2
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
Qcache_not_cached 15
select c from t1;
c
1
@ -110,7 +110,7 @@ Variable_name Value
Qcache_hits 3
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 1
Qcache_not_cached 18
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
@ -143,7 +143,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 2
Qcache_not_cached 22
select "user3";
user3
user3
@ -167,7 +167,7 @@ Variable_name Value
Qcache_hits 7
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 7
Qcache_not_cached 30
select "user4";
user4
user4
@ -197,7 +197,7 @@ Variable_name Value
Qcache_hits 8
show status like "Qcache_not_cached";
Variable_name Value
Qcache_not_cached 8
Qcache_not_cached 34
set names binary;
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");

View File

@ -1,3 +1,6 @@
show variables variable_name where variable_name like "skip_show_database";
variable_name
skip_show_database
grant all privileges on test.* to mysqltest_1@localhost;
select * from information_schema.SCHEMATA where schema_name > 'm';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH
@ -321,11 +324,11 @@ show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE
NULL test v0 select `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO
NULL test v1 select `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO
NULL test v2 select `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO
NULL test v3 select `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO
NULL test v4 select `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO
NULL test v0 select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO
NULL test v1 select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO
NULL test v2 select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO
NULL test v3 select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO
NULL test v4 select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO
drop view v0, v1, v2, v3, v4;
create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost;
@ -661,3 +664,14 @@ select table_type from information_schema.tables
where table_schema="mysql" and table_name="user";
table_type
BASE TABLE
show open tables where `table` like "user";
Database Table In_use Name_locked
mysql user 0 0
show status variable_name where variable_name like "%database%";
variable_name
Com_show_databases
show variables variable_name where variable_name like "%database%";
variable_name
character_set_database
collation_database
skip_show_database

View File

@ -947,3 +947,13 @@ Variable_name Value
Qcache_hits 7
DROP TABLE t1;
SET GLOBAL query_cache_size=0;
SET SESSION query_cache_type = 2;
create table t1(a int);
select table_name from information_schema.tables
where table_schema="test";
table_name
t1
drop table t1;
select table_name from information_schema.tables
where table_schema="test";
table_name

View File

@ -95,5 +95,5 @@ d
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 1
Created_tmp_tables 2
drop table t1;

View File

@ -851,27 +851,27 @@ count(*)
26
show status like 'Slow_queries';
Variable_name Value
Slow_queries 0
Slow_queries 1
select count(*) from t1 where b=13;
count(*)
10
show status like 'Slow_queries';
Variable_name Value
Slow_queries 1
Slow_queries 3
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
count(*)
10
26
show status like 'Slow_queries';
Variable_name Value
Slow_queries 2
Slow_queries 5
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
count(*)
26
10
show status like 'Slow_queries';
Variable_name Value
Slow_queries 3
Slow_queries 7
drop table t1;
create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');

View File

@ -2,6 +2,7 @@
# Test for information_schema.schemata &
# show databases
show variables variable_name where variable_name like "skip_show_database";
grant all privileges on test.* to mysqltest_1@localhost;
select * from information_schema.SCHEMATA where schema_name > 'm';
@ -346,3 +347,10 @@ select TABLE_ROWS from information_schema.tables where
table_schema="information_schema" and table_name="COLUMNS";
select table_type from information_schema.tables
where table_schema="mysql" and table_name="user";
# test for 'show open tables ... where'
show open tables where `table` like "user";
# test for 'show status ... where'
show status variable_name where variable_name like "%database%";
# test for 'show variables ... where'
show variables variable_name where variable_name like "%database%";

View File

@ -686,3 +686,14 @@ show status like "Qcache_hits";
#
DROP TABLE t1;
SET GLOBAL query_cache_size=0;
#
# Information schema & query cache test
#
SET SESSION query_cache_type = 2;
create table t1(a int);
select table_name from information_schema.tables
where table_schema="test";
drop table t1;
select table_name from information_schema.tables
where table_schema="test";