~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/engines/funcs/t/rpl_row_trig002.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-05-11 18:47:32 UTC
  • mto: (2.1.2 sid) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100511184732-jhn055kfhxze24kt
Tags: upstream-5.1.46
ImportĀ upstreamĀ versionĀ 5.1.46

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#############################################################################
 
2
# Original Author: JBM                                                      #
 
3
# Original Date: Aug/14/2005                                                #
 
4
# Updated: 08/29/2005 added save master pos and sync with master            #
 
5
#############################################################################
 
6
# TEST: Taken and modified from BUG#12048 After Insert updates replication  #
 
7
#############################################################################
 
8
 
 
9
# Includes
 
10
-- source include/have_binlog_format_row.inc
 
11
-- source include/master-slave.inc
 
12
 
 
13
#-- disable_query_log
 
14
#-- disable_result_log
 
15
 
 
16
# Begin clean up test section
 
17
connection master;
 
18
--disable_warnings      
 
19
--error 0,1360
 
20
DROP TRIGGER test.t2_ai;
 
21
DROP TABLE IF EXISTS test.t1;
 
22
DROP TABLE IF EXISTS test.t2;
 
23
DROP TABLE IF EXISTS test.t3;
 
24
--enable_warnings
 
25
 
 
26
# test section 1,  Taken from bug #12408
 
27
 
 
28
CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
 
29
 
 
30
CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
 
31
 
 
32
CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
 
33
 
 
34
delimiter |;
 
35
CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d  SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL  AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
 
36
delimiter ;|
 
37
 
 
38
INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
 
39
 
 
40
SELECT * FROM test.t1 ORDER BY id;
 
41
#show binlog events;
 
42
save_master_pos;
 
43
connection slave;
 
44
sync_with_master;
 
45
SELECT * FROM test.t1 ORDER BY id;
 
46
connection master;
 
47
 
 
48
INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
 
49
INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
 
50
INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
 
51
 
 
52
select * from test.t2;
 
53
--sorted_result
 
54
select * from test.t3;
 
55
save_master_pos;
 
56
connection slave;
 
57
sync_with_master;
 
58
select * from test.t2;
 
59
--sorted_result
 
60
select * from test.t3;
 
61
connection master;
 
62
 
 
63
DELETE FROM test.t1 WHERE id = 1;
 
64
 
 
65
SELECT * FROM test.t1 ORDER BY id;
 
66
connection master;
 
67
SELECT * FROM test.t1 ORDER BY id;
 
68
save_master_pos;
 
69
connection slave;
 
70
sync_with_master;
 
71
SELECT * FROM test.t1 ORDER BY id;
 
72
 
 
73
# Cleanup
 
74
connection master;
 
75
#show binlog events; 
 
76
DROP TRIGGER test.t2_ai;
 
77
DROP TABLE test.t1;
 
78
DROP TABLE test.t2;
 
79
DROP TABLE test.t3;
 
80
sync_slave_with_master;
 
81
 
 
82
# End of 5.0 test case