summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorgluh@gluh.mysql.r18.ru <>2003-07-18 14:11:01 +0500
committergluh@gluh.mysql.r18.ru <>2003-07-18 14:11:01 +0500
commit333bddb33ffa00989a98fdfa6157f5abff3e7cd6 (patch)
tree781fa5cf6448620f00a72dd55b39685f4d0de79a /mysql-test
parent39e7db9f51fb9f78d7c3846ad11afd1f13778593 (diff)
downloadmariadb-git-333bddb33ffa00989a98fdfa6157f5abff3e7cd6.tar.gz
SCRUM:
Task 499 'init_connect, init_slave options'
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/init_connect.result24
-rw-r--r--mysql-test/r/rpl_init_slave.result23
-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
7 files changed, 110 insertions, 1 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 137e99f48b3..502644ad588 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -775,7 +775,7 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
- $@ >> $CUR_MYERR 2>&1 &
+ echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
sleep 2 #hack
return
fi
diff --git a/mysql-test/r/init_connect.result b/mysql-test/r/init_connect.result
new file mode 100644
index 00000000000..3f8e726c775
--- /dev/null
+++ b/mysql-test/r/init_connect.result
@@ -0,0 +1,24 @@
+select hex(@a);
+hex(@a)
+NULL
+select hex(@a);
+hex(@a)
+610063
+set global init_connect="set @a=2;set @b=3";
+select @a, @b;
+@a @b
+2 3
+set GLOBAL init_connect=DEFAULT;
+select @a;
+@a
+NULL
+set global init_connect="create table t1(a char(10));\
+insert into t1 values ('\0');insert into t1 values('abc')";
+select hex(a) from t1;
+hex(a)
+00
+616263
+set GLOBAL init_connect="adsfsdfsdfs";
+select @a;
+ERROR HY000: Lost connection to MySQL server during query
+drop table t1;
diff --git a/mysql-test/r/rpl_init_slave.result b/mysql-test/r/rpl_init_slave.result
new file mode 100644
index 00000000000..a91b2da85cd
--- /dev/null
+++ b/mysql-test/r/rpl_init_slave.result
@@ -0,0 +1,23 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+reset master;
+create table t1(n int);
+insert into t1 values (@a), (@b);
+select * from t1;
+n
+NULL
+NULL
+select * from t1;
+n
+1
+2
+set global init_connect="set @c=1";
+show variables like 'init_connect';
+Variable_name Value
+init_connect set @c=1
+drop table t1;
+stop slave;
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;