Debian Codegraph @

mysql-test/suite/parts/inc/partition_check_read.inc

raw
1 ################################################################################
2 # inc/partition_check_read.inc #
3 # #
4 # Purpose: #
5 # Read table t1 row by row #
6 # This routine is only useful for the partition_<feature>_<engine> tests. #
7 # #
8 # Note: If this routine is successful, at least the following is fullfilled #
9 # - select single row via $col_to_check basically works -- no crash #
10 # - the table contains all expected rows #
11 # #
12 #------------------------------------------------------------------------------#
13 # Original Author: mleich #
14 # Original Date: 2006-03-05 #
15 # Change Author: #
16 # Change Date: #
17 # Change: #
18 ################################################################################
19
20 let $success= 1;
21
22 ## Read all existing records
23 let $num= `SELECT @max_row`;
24 while ($num)
25 {
26 if ($no_debug)
27 {
28 --disable_query_log
29 }
30 --disable_cursor_protocol
31 eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE $col_to_check = $num;
32 --enable_cursor_protocol
33 --enable_query_log
34 let $run= `SELECT @aux`;
35 if ($run)
36 {
37 --echo # Unexpected result on SELECT
38 eval SELECT COUNT(*) <> 1 FROM t1 WHERE $col_to_check = $num;
39 let $success= 0;
40 }
41 dec $num;
42 }
43 ## Read some not existing records
44 let $num= `SELECT @max_row_div2`;
45 while ($num)
46 {
47 if ($no_debug)
48 {
49 --disable_query_log
50 }
51 --disable_cursor_protocol
52 eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = @max_row + $num;
53 --enable_cursor_protocol
54 --enable_query_log
55 let $run= `SELECT @aux`;
56 if ($run)
57 {
58 --echo # Unexpected result on SELECT
59 eval SELECT COUNT(*) <> 1 FROM t1 WHERE $col_to_check = @max_row + $num;
60 let $success= 0;
61 }
62 dec $num;
63 }
64 let $num= `SELECT @max_row_div2`;
65 while ($num)
66 {
67 if ($no_debug)
68 {
69 --disable_query_log
70 }
71 --disable_cursor_protocol
72 eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = 1 - $num;
73 --enable_cursor_protocol
74 --enable_query_log
75 let $run= `SELECT @aux`;
76 if ($run)
77 {
78 --echo # Unexpected result on SELECT
79 eval SELECT COUNT(*) <> 1 FROM t1 WHERE $col_to_check = 1 - $num;
80 let $success= 0;
81 }
82 dec $num;
83 }
84 if ($no_debug)
85 {
86 --disable_query_log
87 }
88 --echo # check read via $col_to_check success: $success
89 # mleich: The following is omitted because of not reported mysqltest bug
90 # (@max_row time the success message)
91 if (0)
92 {
93 eval SELECT '# check read via $col_to_check success: ' AS "", $success AS "" FROM t1;
94 }
95 --enable_query_log