~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_row_sp009.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
# 2006-02-08 By JBM : Added order by for ndb engine use
 
9
#############################################################################
 
10
 
 
11
# Includes
 
12
-- source include/have_binlog_format_row.inc
 
13
-- source include/master-slave.inc
 
14
 
 
15
 
 
16
# Begin clean up test section
 
17
connection master;
 
18
--disable_warnings
 
19
DROP PROCEDURE IF EXISTS test.p1;
 
20
DROP TABLE IF EXISTS test.t1;
 
21
DROP TABLE IF EXISTS test.t2;
 
22
 
 
23
 
 
24
# Begin test section 1 
 
25
CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
 
26
INSERT INTO test.t1 VALUES (1),(2),(3),(4);
 
27
CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
 
28
 
 
29
delimiter |;
 
30
CREATE PROCEDURE test.p1 (arg1 CHAR(1))
 
31
BEGIN
 
32
  DECLARE b, c INT;
 
33
  IF arg1 = 'a' THEN
 
34
    BEGIN
 
35
      DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
 
36
      DECLARE continue handler for not found set b = 1;
 
37
      SET b = 0;
 
38
      OPEN cur1;
 
39
      c1_repeat: REPEAT
 
40
        FETCH cur1 INTO c;
 
41
        IF (b = 1) THEN
 
42
          LEAVE c1_repeat;
 
43
        END IF;
 
44
 
 
45
        INSERT INTO test.t2 VALUES (c);
 
46
        UNTIL b = 1
 
47
      END REPEAT;
 
48
      CLOSE cur1;
 
49
    END;
 
50
  END IF;
 
51
  IF arg1 = 'b' THEN
 
52
    BEGIN
 
53
      DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
 
54
      DECLARE continue handler for not found set b = 1;
 
55
      SET b = 0;
 
56
      OPEN cur2;
 
57
      c2_repeat: REPEAT
 
58
        FETCH cur2 INTO c;
 
59
        IF (b = 1) THEN
 
60
          LEAVE c2_repeat;
 
61
        END IF;
 
62
 
 
63
        INSERT INTO test.t2 VALUES (c);
 
64
        UNTIL b = 1
 
65
      END REPEAT;
 
66
      CLOSE cur2;
 
67
    END;
 
68
  END IF;
 
69
END|
 
70
delimiter ;|
 
71
 
 
72
CALL test.p1('a');
 
73
SELECT * FROM test.t2 ORDER BY a;
 
74
save_master_pos;
 
75
connection slave;
 
76
sync_with_master;
 
77
SELECT * FROM test.t2 ORDER BY a;
 
78
connection master;
 
79
truncate test.t2;
 
80
 
 
81
# this next call fails, but should not
 
82
call test.p1('b');
 
83
select * from test.t2 ORDER BY a;
 
84
save_master_pos;
 
85
connection slave;
 
86
sync_with_master;
 
87
SELECT * FROM test.t2 ORDER BY a;
 
88
 
 
89
connection master;
 
90
truncate test.t2;
 
91
SELECT * FROM test.t2 ORDER BY a;
 
92
save_master_pos;
 
93
connection slave;
 
94
sync_with_master;
 
95
SELECT * FROM test.t2 ORDER BY a;
 
96
 
 
97
# Cleanup
 
98
connection master;
 
99
#show binlog events;
 
100
DROP PROCEDURE test.p1;
 
101
DROP TABLE test.t1;
 
102
DROP TABLE test.t2;
 
103
sync_slave_with_master;
 
104
 
 
105
# End of 5.0 test case