2
# Test of replicating user variables
4
###########################################################
5
# 2006-02-08 By JBM added order by for use w/ NDB engine
6
###########################################################
7
source include/master-slave.inc;
16
drop table if exists t1;
19
create table t1(n char(30));
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;
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;
36
SELECT * FROM t1 ORDER BY n;
50
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
53
# There were actually two problems discovered by this bug:
55
# 1. Default (current) database is not fixed at the creation time.
56
# That leads to wrong output of DATABASE() function.
58
# 2. Database attributes (@@collation_database) are not fixed at the creation
59
# time. That leads to wrong resultset.
61
# Binlog breakage and Query Cache wrong output happened because of the first
66
--echo ########################################################################
68
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
69
--echo # statement breaks binlog.
71
--echo ########################################################################
73
###############################################################################
76
--echo # Connection: slave
84
--echo # Connection: master
89
CREATE DATABASE mysqltest1;
90
CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
93
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
108
--echo # Connection: slave
117
--echo # Connection: master
122
DROP DATABASE mysqltest1;
131
--echo # Connection: slave
140
--echo ########################################################################
142
###############################################################################