Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_sp009.test

raw
1 #############################################################################
2 # Original Author: JBM #
3 # Original Date: Aug/18/2005 #
4 # Updated: 08/29/2005 removed sleeps and added master pos save and snyc #
5 #############################################################################
6 #TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 #
7 #############################################################################
8
9 # Includes
10 -- source include/have_binlog_format_row.inc
11 -- source include/master-slave.inc
12
13
14 # Begin clean up test section
15 connection master;
16 --disable_warnings
17 DROP PROCEDURE IF EXISTS test.p1;
18 DROP TABLE IF EXISTS test.t1;
19 DROP TABLE IF EXISTS test.t2;
20
21
22 # Begin test section 1
23 CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
24 INSERT INTO test.t1 VALUES (1),(2),(3),(4);
25 CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
26
27 delimiter |;
28 CREATE PROCEDURE test.p1 (arg1 CHAR(1))
29 BEGIN
30 DECLARE b, c INT;
31 IF arg1 = 'a' THEN
32 BEGIN
33 DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
34 DECLARE continue handler for not found set b = 1;
35 SET b = 0;
36 OPEN cur1;
37 c1_repeat: REPEAT
38 FETCH cur1 INTO c;
39 IF (b = 1) THEN
40 LEAVE c1_repeat;
41 END IF;
42
43 INSERT INTO test.t2 VALUES (c);
44 UNTIL b = 1
45 END REPEAT;
46 CLOSE cur1;
47 END;
48 END IF;
49 IF arg1 = 'b' THEN
50 BEGIN
51 DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
52 DECLARE continue handler for not found set b = 1;
53 SET b = 0;
54 OPEN cur2;
55 c2_repeat: REPEAT
56 FETCH cur2 INTO c;
57 IF (b = 1) THEN
58 LEAVE c2_repeat;
59 END IF;
60
61 INSERT INTO test.t2 VALUES (c);
62 UNTIL b = 1
63 END REPEAT;
64 CLOSE cur2;
65 END;
66 END IF;
67 END|
68 delimiter ;|
69
70 CALL test.p1('a');
71 SELECT * FROM test.t2 ORDER BY a;
72 sync_slave_with_master;
73 SELECT * FROM test.t2 ORDER BY a;
74 connection master;
75 truncate test.t2;
76
77 # this next call fails, but should not
78 call test.p1('b');
79 select * from test.t2 ORDER BY a;
80 sync_slave_with_master;
81 SELECT * FROM test.t2 ORDER BY a;
82
83 connection master;
84 truncate test.t2;
85 SELECT * FROM test.t2 ORDER BY a;
86 sync_slave_with_master;
87 SELECT * FROM test.t2 ORDER BY a;
88
89 # Cleanup
90 connection master;
91 #show binlog events;
92 DROP PROCEDURE test.p1;
93 DROP TABLE test.t1;
94 DROP TABLE test.t2;
95 sync_slave_with_master;
96
97 # End of 5.0 test case
98 --source include/rpl_end.inc