1
set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
2
create table test_db select * from mysql.db;
4
insert into test_db (Host,Db,User) values (@name,@name,@name);
5
create table test_host select * from mysql.host;
7
insert into test_host (Host,Db) values (@name,@name);
8
create table test_user select * from mysql.user;
10
insert into test_user (Host,User) values (@name,@name);
11
create table test_func select * from mysql.func;
12
delete from test_func;
13
insert into test_func (name) values (@name);
14
create table test_tables_priv select * from mysql.tables_priv;
15
delete from test_tables_priv;
16
insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
17
create table test_columns_priv select * from mysql.columns_priv;
18
delete from test_columns_priv;
19
insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
21
if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
22
if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
23
if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
24
if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
25
if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
27
left join test_host on test_db.Host=test_host.Host
28
left join test_user on test_db.Host=test_user.Host
29
left join test_tables_priv on test_db.Host=test_tables_priv.Host
30
left join test_columns_priv on test_db.Host=test_columns_priv.Host;
31
test_db_Host test_host_Host test_user_Host test_tables_priv_Host test_columns_priv_Host
34
if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
35
if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
36
if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
37
if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
39
left join test_host on test_db.Db=test_host.Db
40
left join test_tables_priv on test_db.Db=test_tables_priv.Db
41
left join test_columns_priv on test_db.Db=test_columns_priv.Db;
42
test_db_Db test_host_Db test_tables_priv_Db est_columns_priv_Db
45
if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
46
if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
47
if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
48
if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
50
left join test_user on test_db.User=test_user.User
51
left join test_tables_priv on test_db.User=test_tables_priv.User
52
left join test_columns_priv on test_db.User=test_columns_priv.User;
53
test_db_User test_user_User test_tables_priv_User test_columns_priv_User
56
if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
57
if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
59
left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
60
test_tables_priv_User test_columns_priv_User
62
drop table test_columns_priv;
63
drop table test_tables_priv;