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