mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
34 lines
1.1 KiB
Text
34 lines
1.1 KiB
Text
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//
|
|
connection slave;
|
|
connection master;
|
|
connection master;
|
|
INSERT INTO test.t1 VALUES (1+1, NOW());
|
|
connection slave;
|
|
|
|
<End test section 2 (Tiggers & SP)>
|
|
-----------------------------------
|
|
connection master;
|
|
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;
|
|
connection slave;
|
|
include/rpl_end.inc
|