summaryrefslogtreecommitdiff
path: root/mysql-test/t/user_var.test
diff options
context:
space:
mode:
authorunknown <monty@mishka.mysql.fi>2003-10-03 00:40:27 +0300
committerunknown <monty@mishka.mysql.fi>2003-10-03 00:40:27 +0300
commit2985e91acd78841fac42b298cea19c7332895eb9 (patch)
treedae461536c421dd366da2962a088561908db14ce /mysql-test/t/user_var.test
parent904dee7a9774510b3b5992d86981b0f467d8fe3c (diff)
downloadmariadb-git-2985e91acd78841fac42b298cea19c7332895eb9.tar.gz
Optimized code for setting user variables with := and fixed some bugs in old code (Bug #1194)
Use forced close of socket to make mysqld shutdown faster when used under valgrind mysql-test/mysql-test-run.sh: Added --skip-bdb for valgrind mysql-test/r/user_var.result: Extended test for user variables mysql-test/t/user_var.test: Extended test for user variables sql/item_func.cc: Optimized code for setting user variables with := and fixed some bugs in old code sql/item_func.h: Optimized code for setting user variables sql/log.cc: Fixed comments sql/mysqld.cc: Use forced close of socket to make mysqld shutdown faster when used under valgrind sql/sql_class.h: Optimized code for setting user variables
Diffstat (limited to 'mysql-test/t/user_var.test')
-rw-r--r--mysql-test/t/user_var.test19
1 files changed, 15 insertions, 4 deletions
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 1e466c149bb..56528405a2a 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -19,8 +19,11 @@ explain select * from t1 where i=@vv1;
drop table t1,t2;
# Check types of variables
+set @a=0,@b=0;
select @a:=10, @b:=1, @a > @b, @a < @b;
+# Note that here a and b will be avaluated as number
select @a:="10", @b:="1", @a > @b, @a < @b;
+# Note that here a and b will be avaluated as strings
select @a:=10, @b:=2, @a > @b, @a < @b;
select @a:="10", @b:="2", @a > @b, @a < @b;
@@ -28,8 +31,8 @@ select @a:="10", @b:="2", @a > @b, @a < @b;
select @a:=1;
select @a, @a:=1;
-create table t1 (id int);
-insert into t1 values (1);
+create table t1 (id int, d double, c char(10));
+insert into t1 values (1,2.0, "test");
select @c:=0;
update t1 SET id=(@c:=@c+1);
select @c;
@@ -38,7 +41,15 @@ update t1 set id=(@c:=@c+1);
select @c;
select @c:=0;
select @c:=@c+1;
+select @d,(@d:=id),@d from t1;
+select @e,(@e:=d),@e from t1;
+select @f,(@f:=c),@f from t1;
+set @g=1;
+select @g,(@g:=c),@g from t1;
+select @c, @d, @e, @f;
+select @d:=id, @e:=id, @f:=id, @g:=@id from t1;
+select @c, @d, @e, @f, @g;
drop table t1;
-# just fof fun :)
-select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b; \ No newline at end of file
+# just for fun :)
+select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;