Debian Codegraph @

mysql-test/suite/ndb/t/ndbinfo_tables.test

raw
1 #
2 # Perform various queries from the ndbinfo. tables checking that
3 # the table schema and the views are working when selecting
4 # all rows or selected rows and with the various ratelimits
5 #
6
7 --result_format 2
8 --source include/have_ndb.inc
9
10 --disable_query_log
11 --disable_result_log
12
13 use ndbinfo;
14
15 set @@ndbinfo_show_hidden = 1;
16
17 ### Load list of tables and views in ndbinfo database into temporary table
18 create temporary table table_names as
19 select REPLACE(TABLE_NAME, '$', '\$') as TABLE_NAME, TABLE_TYPE
20 from information_schema.tables
21 where TABLE_SCHEMA = 'ndbinfo';
22
23 ### Iterate the list and run test for each object
24 while (`select count(*) from table_names`)
25 {
26 ### Find one object to test
27 select @test_table := TABLE_NAME,
28 @test_table_type := TABLE_TYPE
29 from table_names order by TABLE_NAME limit 1;
30 let $test_table = `select @test_table`;
31 let $test_table_type = `select @test_table_type`;
32
33 ##
34 # Run plain select from the table
35 eval select * from $test_table;
36
37 ##
38 # Select one column at a time
39 let $columns = `select count(*) from information_schema.columns
40 where TABLE_NAME = @test_table and
41 TABLE_SCHEMA='ndbinfo'`;
42 #echo $test_table has $columns columns;
43
44 let $c = $columns;
45 while($c)
46 {
47 let $col_name = `select COLUMN_NAME from information_schema.columns
48 where TABLE_NAME = @test_table and
49 TABLE_SCHEMA='ndbinfo' and
50 ORDINAL_POSITION = $c`;
51 eval select `$col_name` from $test_table;
52
53 dec $c;
54 }
55
56 ##
57 # Run plain select with different max_rows and max_bytes
58 create temporary table limits (max_rows int, max_bytes int);
59 insert into limits values
60 ( 0, 0 ),
61 ( 1, 0 ), ( 2, 0 ), ( 10, 0 ), ( 37, 0 ), ( 1000, 0 ),
62 ( 0, 1 ), ( 0, 2 ), ( 0, 10 ), ( 0, 37 ), ( 0, 1000 ),
63 ( 1, 1 ), ( 2, 2 ), ( 10, 10 ), ( 37, 37 ), ( 1000, 1000 );
64 while (`select count(*) from limits`)
65 {
66 # Find next limit to test
67 select @max_rows := max_rows,
68 @max_bytes := max_bytes
69 from limits order by max_rows, max_bytes limit 1;
70
71 set @@ndbinfo_max_bytes = @max_bytes;
72 set @@ndbinfo_max_rows = @max_rows;
73
74 eval select * from $test_table;
75
76 # Remove the tested limit
77 delete from limits
78 where max_rows = @max_rows and max_bytes = @max_bytes;
79 }
80 # Reset defaults
81 set @@ndbinfo_max_bytes = default;
82 set @@ndbinfo_max_rows = default;
83 drop temporary table limits;
84
85 ### Delete the tested table from list
86 delete from table_names
87 where TABLE_NAME = @test_table and TABLE_TYPE = @test_table_type;
88 }
89
90 --enable_query_log
91 --enable_result_log
92
93
94 ## Test completed!