Debian Codegraph @

mysql-test/suite/rpl/t/rpl_ps.test

raw
1 #
2 # Test of replicating user variables
3 #
4 ###########################################################
5 # 2006-02-08 By JBM added order by for use w/ NDB engine
6 ###########################################################
7 --source include/not_group_replication_plugin.inc
8 --source include/set_privilege_checks_user_as_system_user.inc
9 source include/master-slave.inc;
10
11 #--source include/sync_slave_sql_with_master.inc
12 #reset master;
13 #connection master;
14
15 --disable_warnings
16 drop table if exists t1;
17 --enable_warnings
18
19 create table t1(n char(30));
20
21 prepare stmt1 from 'insert into t1 values (?)';
22 set @var1= "from-master-1";
23 execute stmt1 using @var1;
24 set @var1= "from-master-2-'',";
25 execute stmt1 using @var1;
26 SELECT * FROM t1 ORDER BY n;
27
28 set @var2= 'insert into t1 values (concat("from-var-", ?))';
29 prepare stmt2 from @var2;
30 set @var1='from-master-3';
31 execute stmt2 using @var1;
32
33 --source include/sync_slave_sql_with_master.inc
34 SELECT * FROM t1 ORDER BY n;
35
36 connection master;
37
38 drop table t1;
39
40 --source include/sync_slave_sql_with_master.inc
41 stop slave;
42 source include/wait_for_slave_to_stop.inc;
43 # End of 4.1 tests
44
45 #
46 # Bug #25843 Changing default database between PREPARE and EXECUTE of statement
47 # breaks binlog.
48 #
49 # There were actually two problems discovered by this bug:
50 #
51 # 1. Default (current) database is not fixed at the creation time.
52 # That leads to wrong output of DATABASE() function.
53 #
54 # 2. Database attributes (@@collation_database) are not fixed at the creation
55 # time. That leads to wrong resultset.
56 #
57 # Binlog breakage and Query Cache wrong output happened because of the first
58 # problem.
59 #
60
61 --echo
62 --echo ########################################################################
63 --echo #
64 --echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
65 --echo # statement breaks binlog.
66 --echo #
67 --echo ########################################################################
68
69 ###############################################################################
70
71 --echo # Connection: slave
72 --connection slave
73
74 START SLAVE;
75
76 --echo # Connection: master
77 --connection master
78
79 CREATE DATABASE mysqltest1;
80 CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
81
82 PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
83
84 EXECUTE stmt_d_1;
85
86 use mysqltest1;
87
88 EXECUTE stmt_d_1;
89
90 --echo # Connection: slave
91 --source include/sync_slave_sql_with_master.inc
92
93 SELECT * FROM t1;
94
95 --echo # Connection: master
96 --connection master
97
98 DROP DATABASE mysqltest1;
99
100 use test;
101 DROP TABLE t1;
102
103 --source include/rpl_end.inc