summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2003-02-27 19:08:52 +0100
committerunknown <pem@mysql.com>2003-02-27 19:08:52 +0100
commitaecc6a21bd1e802d31318cf3e82d03d57b090c5f (patch)
treeb7efe78983c562d9dd31ef6ae9f1c7728e01aca8 /mysql-test
parent76b037dc4288fada1b64efbef422cb8b4bd0d5b5 (diff)
downloadmariadb-git-aecc6a21bd1e802d31318cf3e82d03d57b090c5f.tar.gz
A small step forward. Fixed a few bugs and made string type functions work,
but still strange interferences between multiple function invocations... mysql-test/r/sp.result: New FUNCTION tests. mysql-test/t/sp.test: New FUNCTION tests. sql/item_func.cc: Fixed field_type bug; now string functions work too. Removed unecessary function which was added in a state of confusion. sql/item_func.h: Fixed field_type bug; now string functions work too. Removed unecessary function which was added in a state of confusion. sql/sp_head.cc: Fixed string type bug, and set the right charset.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp.result19
-rw-r--r--mysql-test/t/sp.test12
2 files changed, 23 insertions, 8 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 7beaa9fe673..ab445e44a5a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -377,9 +377,10 @@ end;
drop procedure create_select;
create function e() returns double
return 2.7182818284590452354;
-select e();
-e()
-2.718281828459
+set @e = e();
+select e(), @e;
+e() @e
+2.718281828459 2.718281828459
create function inc(i int) returns int
return i+1;
select inc(1), inc(99), inc(-71);
@@ -390,6 +391,11 @@ return x*y;
select mul(1,1), mul(3,5), mul(4711, 666);
mul(1,1) mul(3,5) mul(4711, 666)
1 15 3137526
+create function append(s1 char(8), s2 char(8)) returns char(16)
+return concat(s1, s2);
+select append("foo", "bar");
+append("foo", "bar")
+foobar
create function fac(n int unsigned) returns bigint unsigned
begin
declare f bigint unsigned;
@@ -400,11 +406,12 @@ set n = n - 1;
end while;
return f;
end;
-select fac(1), fac(2), fac(10);
-fac(1) fac(2) fac(10)
-1 2 3628800
+select fac(1), fac(2), fac(5), fac(10);
+fac(1) fac(2) fac(5) fac(10)
+1 2 120 3628800
drop function e;
drop function inc;
drop function mul;
+drop function append;
drop function fac;
drop table t1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index b509ff8e557..17b21f612d6 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -445,7 +445,8 @@ drop procedure create_select|
create function e() returns double
return 2.7182818284590452354|
-select e()|
+set @e = e()|
+select e(), @e|
# A minimal function with one argument
create function inc(i int) returns int
@@ -459,6 +460,12 @@ create function mul(x int, y int) returns int
select mul(1,1), mul(3,5), mul(4711, 666)|
+# A minimal string function
+create function append(s1 char(8), s2 char(8)) returns char(16)
+ return concat(s1, s2)|
+
+select append("foo", "bar")|
+
# A function with flow control
create function fac(n int unsigned) returns bigint unsigned
begin
@@ -472,11 +479,12 @@ begin
return f;
end|
-select fac(1), fac(2), fac(10)|
+select fac(1), fac(2), fac(5), fac(10)|
drop function e|
drop function inc|
drop function mul|
+drop function append|
drop function fac|
delimiter ;|