summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/init_connect-master.opt1
-rw-r--r--mysql-test/t/init_connect.test34
-rw-r--r--mysql-test/t/rpl_init_slave-slave.opt1
-rw-r--r--mysql-test/t/rpl_init_slave.test26
4 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/t/init_connect-master.opt b/mysql-test/t/init_connect-master.opt
new file mode 100644
index 00000000000..e3316c2def5
--- /dev/null
+++ b/mysql-test/t/init_connect-master.opt
@@ -0,0 +1 @@
+--set-variable=init_connect="set @a='a\0c'"
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
new file mode 100644
index 00000000000..563ec6178d0
--- /dev/null
+++ b/mysql-test/t/init_connect.test
@@ -0,0 +1,34 @@
+#
+# Test of init_connect variable
+#
+
+connect (con0,localhost,root,,);
+connection con0;
+select hex(@a);
+connect (con1,localhost,user_1,,);
+connection con1;
+select hex(@a);
+connection con0;
+set global init_connect="set @a=2;set @b=3";
+connect (con2,localhost,user_1,,);
+connection con2;
+select @a, @b;
+connection con0;
+set GLOBAL init_connect=DEFAULT;
+connect (con3,localhost,user_1,,);
+connection con3;
+select @a;
+connection con0;
+set global init_connect="create table t1(a char(10));\
+insert into t1 values ('\0');insert into t1 values('abc')";
+connect (con4,localhost,user_1,,);
+connection con4;
+select hex(a) from t1;
+connection con0;
+set GLOBAL init_connect="adsfsdfsdfs";
+connect (con5,localhost,user_1,,);
+connection con5;
+--error 2013
+select @a;
+connection con0;
+drop table t1;
diff --git a/mysql-test/t/rpl_init_slave-slave.opt b/mysql-test/t/rpl_init_slave-slave.opt
new file mode 100644
index 00000000000..6433dccf4aa
--- /dev/null
+++ b/mysql-test/t/rpl_init_slave-slave.opt
@@ -0,0 +1 @@
+--init-slave="set @a=1;set @b=2"
diff --git a/mysql-test/t/rpl_init_slave.test b/mysql-test/t/rpl_init_slave.test
new file mode 100644
index 00000000000..67d35546225
--- /dev/null
+++ b/mysql-test/t/rpl_init_slave.test
@@ -0,0 +1,26 @@
+source include/master-slave.inc;
+
+#
+# Test of init_slave variable
+#
+
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
+connection master;
+create table t1(n int);
+insert into t1 values (@a), (@b);
+select * from t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+select * from t1;
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+stop slave;