2006-05-30 10:45:23 +05:00
|
|
|
drop table if exists t1,t2;
|
|
|
|
drop view if exists v1,v2;
|
|
|
|
drop function if exists f1;
|
|
|
|
drop function if exists f2;
|
2005-05-06 19:06:10 +00:00
|
|
|
use INFORMATION_SCHEMA;
|
|
|
|
show tables;
|
2005-05-24 14:35:23 +04:00
|
|
|
Tables_in_information_schema
|
2005-05-06 19:06:10 +00:00
|
|
|
CHARACTER_SETS
|
|
|
|
COLLATIONS
|
|
|
|
COLLATION_CHARACTER_SET_APPLICABILITY
|
2005-08-05 11:01:29 +02:00
|
|
|
COLUMNS
|
|
|
|
COLUMN_PRIVILEGES
|
2005-12-22 01:07:47 -08:00
|
|
|
ENGINES
|
2006-01-30 13:15:23 +01:00
|
|
|
EVENTS
|
2006-02-02 00:47:08 +11:00
|
|
|
FILES
|
2005-08-05 11:01:29 +02:00
|
|
|
KEY_COLUMN_USAGE
|
2006-01-10 19:44:04 +04:00
|
|
|
PARTITIONS
|
2005-12-21 10:18:40 -08:00
|
|
|
PLUGINS
|
2006-02-16 16:45:05 +03:00
|
|
|
PROCESSLIST
|
2006-05-02 16:31:39 +05:00
|
|
|
REFERENTIAL_CONSTRAINTS
|
2005-05-06 19:06:10 +00:00
|
|
|
ROUTINES
|
2005-08-05 11:01:29 +02:00
|
|
|
SCHEMATA
|
2005-05-06 19:06:10 +00:00
|
|
|
SCHEMA_PRIVILEGES
|
2005-08-05 11:01:29 +02:00
|
|
|
STATISTICS
|
|
|
|
TABLES
|
2005-05-06 19:06:10 +00:00
|
|
|
TABLE_CONSTRAINTS
|
2005-08-05 11:01:29 +02:00
|
|
|
TABLE_PRIVILEGES
|
2005-07-19 20:06:49 +04:00
|
|
|
TRIGGERS
|
2005-08-05 11:01:29 +02:00
|
|
|
USER_PRIVILEGES
|
2006-01-28 19:44:51 -06:00
|
|
|
VIEWS
|
2005-05-06 19:06:10 +00:00
|
|
|
show tables from INFORMATION_SCHEMA like 'T%';
|
2005-05-24 14:35:23 +04:00
|
|
|
Tables_in_information_schema (T%)
|
2005-05-06 19:06:10 +00:00
|
|
|
TABLES
|
|
|
|
TABLE_CONSTRAINTS
|
2005-08-05 11:01:29 +02:00
|
|
|
TABLE_PRIVILEGES
|
2005-07-19 20:06:49 +04:00
|
|
|
TRIGGERS
|
2005-05-06 19:06:10 +00:00
|
|
|
create database `inf%`;
|
2006-05-30 10:45:23 +05:00
|
|
|
create database mbase;
|
2005-05-06 19:06:10 +00:00
|
|
|
use `inf%`;
|
|
|
|
show tables;
|
|
|
|
Tables_in_inf%
|
2006-03-20 13:42:02 +04:00
|
|
|
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
|
2006-05-30 10:45:23 +05:00
|
|
|
grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
|
2006-03-20 13:42:02 +04:00
|
|
|
create table t1 (f1 int);
|
|
|
|
create function func1(curr_int int) returns int
|
|
|
|
begin
|
|
|
|
declare ret_val int;
|
|
|
|
select max(f1) from t1 into ret_val;
|
|
|
|
return ret_val;
|
|
|
|
end|
|
|
|
|
create view v1 as select f1 from t1 where f1 = func1(f1);
|
2006-05-30 10:45:23 +05:00
|
|
|
create function func2() returns int return 1;
|
|
|
|
use mbase;
|
|
|
|
create procedure p1 ()
|
|
|
|
begin
|
|
|
|
select table_name from information_schema.key_column_usage
|
|
|
|
order by table_name;
|
|
|
|
end|
|
|
|
|
create table t1
|
|
|
|
(f1 int(10) unsigned not null,
|
|
|
|
f2 varchar(100) not null,
|
|
|
|
primary key (f1), unique key (f2));
|
2006-03-20 13:42:02 +04:00
|
|
|
select * from information_schema.tables;
|
2006-05-30 10:45:23 +05:00
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
|
|
|
use `inf%`;
|
2006-03-20 13:42:02 +04:00
|
|
|
drop user mysqltest_1@localhost;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
|
|
|
table_name table_type table_comment
|
|
|
|
v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
|
|
|
table_name table_type table_comment
|
|
|
|
v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
|
2006-03-20 13:42:02 +04:00
|
|
|
drop view v1;
|
|
|
|
drop function func1;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop function func2;
|
2005-05-06 19:06:10 +00:00
|
|
|
drop database `inf%`;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop procedure mbase.p1;
|
|
|
|
drop database mbase;
|
|
|
|
use test;
|
|
|
|
create table t1 (i int);
|
|
|
|
create function f1 () returns int return (select max(i) from t1);
|
|
|
|
create view v1 as select f1();
|
|
|
|
create table t2 (id int);
|
|
|
|
create function f2 () returns int return (select max(i) from t2);
|
|
|
|
create view v2 as select f2();
|
|
|
|
drop table t2;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
table_name table_type table_comment
|
|
|
|
t1 BASE TABLE
|
|
|
|
v1 VIEW VIEW
|
|
|
|
v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
|
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
table_name table_type table_comment
|
|
|
|
v1 VIEW View 'test.v1' references invalid table(s) or column(s) or function(s) or define
|
|
|
|
v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
|
|
|
|
drop function f1;
|
|
|
|
drop function f2;
|
|
|
|
drop view v1, v2;
|