blob: d55ba04293a8c13e93ea5591c22b088b6eff39a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
include/master-slave.inc
[connection master]
connection master;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
CALL proc1(@cnt);
SELECT @cnt;
@cnt
0
INSERT INTO t1 VALUES (1), (2), (3);
CALL proc1(@cnt);
SELECT @cnt;
@cnt
3
# Syncing with slave
connection slave;
CALL proc1(@cnt);
SELECT @cnt;
@cnt
3
connection master;
CREATE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
ERROR 42000: PROCEDURE proc1 already exists
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
Warnings:
Note 1304 PROCEDURE proc1 already exists
CREATE OR REPLACE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
# Syncing with slave
connection slave;
CALL proc1(@cnt);
SELECT @cnt;
@cnt
3
connection master;
DROP PROCEDURE proc1;
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
INSERT INTO t1 VALUES (1), (2), (3);
CALL proc1(@cnt);
SELECT @cnt;
@cnt
6
# Syncing with slave
connection slave;
CALL proc1(@cnt);
SELECT @cnt;
@cnt
6
connection master;
DROP PROCEDURE proc1;
CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
INSERT INTO t1 VALUES (1), (2), (3);
CALL proc1(@cnt);
SELECT @cnt;
@cnt
9
# Syncing with slave
connection slave;
CALL proc1(@cnt);
SELECT @cnt;
@cnt
9
connection master;
DROP TABLE IF EXISTS t1;
DROP PROCEDURE proc1;
DROP PROCEDURE IF EXISTS proc2;
Warnings:
Note 1305 PROCEDURE test.proc2 does not exist
# Syncing with slave
connection slave;
DROP PROCEDURE proc1;
ERROR 42000: PROCEDURE test.proc1 does not exist
include/rpl_end.inc
|