~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# This test must examine integrity of current system database
3
#
4
5
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";
6
7
#
8
# If this part is wrong, most likely you've done wrong modification of system database "mysql"
9
#
10
11
create table test_db select * from mysql.db;
12
delete from test_db;
13
--disable_warnings
14
insert into test_db (Host,Db,User) values (@name,@name,@name);
15
--enable_warnings
16
17
create table test_host select * from mysql.host;
18
delete from test_host;
19
--disable_warnings
20
insert into test_host (Host,Db) values (@name,@name);
21
--enable_warnings
22
23
create table test_user select * from mysql.user;
24
delete from test_user;
25
--disable_warnings
26
insert into test_user (Host,User) values (@name,@name);
27
--enable_warnings
28
29
create table test_func select * from mysql.func;
30
delete from test_func;
31
--disable_warnings
32
insert into test_func (name) values (@name);
33
--enable_warnings
34
35
create table test_tables_priv select * from mysql.tables_priv;
36
delete from test_tables_priv;
37
--disable_warnings
38
insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
39
--enable_warnings
40
41
create table test_columns_priv select * from mysql.columns_priv;
42
delete from test_columns_priv;
43
--disable_warnings
44
insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
45
--enable_warnings
46
47
# 'Host' field must be the same for all the tables:
48
49
select
50
 if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
51
 if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
52
 if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
53
 if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
54
 if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
55
56
from      test_db
57
left join test_host         on test_db.Host=test_host.Host
58
left join test_user         on test_db.Host=test_user.Host
59
left join test_tables_priv  on test_db.Host=test_tables_priv.Host
60
left join test_columns_priv on test_db.Host=test_columns_priv.Host;
61
62
# 'Db' field must be the same for all the tables:
63
64
select
65
 if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
66
 if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
67
 if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
68
 if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
69
70
from      test_db
71
left join test_host         on test_db.Db=test_host.Db
72
left join test_tables_priv  on test_db.Db=test_tables_priv.Db
73
left join test_columns_priv on test_db.Db=test_columns_priv.Db;
74
75
# 'User' field must be the same for all the tables:
76
77
select
78
 if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
79
 if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
80
 if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
81
 if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
82
83
from      test_db
84
left join test_user         on test_db.User=test_user.User
85
left join test_tables_priv  on test_db.User=test_tables_priv.User
86
left join test_columns_priv on test_db.User=test_columns_priv.User;
87
88
# 'Table_name' field must be the same for all the tables:
89
90
select
91
 if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
92
 if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
93
from      test_tables_priv
94
left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
95
96
drop table test_columns_priv;
97
drop table test_tables_priv;
98
drop table test_func;
99
drop table test_host;
100
drop table test_user;
101
drop table test_db;
102
103
# End of 4.1 tests