blob: d00da976d3030eee0741ed1c82472fed3e42d6e5 (
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
|
include/master-slave.inc
[connection master]
CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
INSERT INTO test.t1 VALUES (1,NOW());
CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1//
CREATE PROCEDURE test.p3()
BEGIN
INSERT INTO test.t3 (d) VALUES (NOW());
END//
CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
CREATE PROCEDURE test.p2()
BEGIN
INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
END//
INSERT INTO test.t1 VALUES (1+1, NOW());
<End test section 2 (Tiggers & SP)>
-----------------------------------
DROP PROCEDURE test.p2;
DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
include/rpl_end.inc
|