diff options
Diffstat (limited to 'mysql-test/r/sp.result')
-rw-r--r-- | mysql-test/r/sp.result | 162 |
1 files changed, 111 insertions, 51 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 1fd519bc729..0af6b821ce0 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -693,7 +693,7 @@ drop procedure if exists create_select| create procedure create_select(x char(16), y int) begin insert into test.t1 values (x, y); -create table test.t3 select * from test.t1; +create temporary table test.t3 select * from test.t1; insert into test.t3 values (concat(x, "2"), y+2); end| drop table if exists t3| @@ -775,11 +775,11 @@ drop procedure if exists hndlr1| create procedure hndlr1(val int) begin declare x int default 0; -declare foo condition for 1146; +declare foo condition for 1136; declare bar condition for sqlstate '42S98'; # Just for testing syntax declare zip condition for sqlstate value '42S99'; # Just for testing syntax declare continue handler for foo set x = 1; -insert into test.t666 values ("hndlr1", val); # Non-existing table +insert into test.t1 values ("hndlr1", val, 2); # Too many values if (x) then insert into test.t1 values ("hndlr1", val); # This instead then end if; @@ -795,8 +795,8 @@ create procedure hndlr2(val int) begin declare x int default 0; begin -declare exit handler for sqlstate '42S02' set x = 1; -insert into test.t666 values ("hndlr2", val); # Non-existing table +declare exit handler for sqlstate '21S01' set x = 1; +insert into test.t1 values ("hndlr2", val, 2); # Too many values end; insert into test.t1 values ("hndlr2", x); end| @@ -820,7 +820,7 @@ if val < 10 then begin declare y int; set y = val + 10; -insert into test.t666 values ("hndlr3", y); # Non-existing table +insert into test.t1 values ("hndlr3", y, 2); # Too many values if x then insert into test.t1 values ("hndlr3", y); end if; @@ -1239,18 +1239,6 @@ call bug2227(9)| 1.3 x y 42 z 1.3 9 2.6 42 zzz drop procedure bug2227| -drop procedure if exists bug2614| -create procedure bug2614() -begin -drop table if exists t3; -create table t3 (id int default '0' not null); -insert into t3 select 12; -insert into t3 select * from t3; -end| -call bug2614()| -call bug2614()| -drop table t3| -drop procedure bug2614| drop function if exists bug2674| create function bug2674() returns int return @@sort_buffer_size| @@ -1551,7 +1539,7 @@ drop procedure if exists bug2460_2| create procedure bug2460_2() begin drop table if exists t3; -create table t3 (s1 int); +create temporary table t3 (s1 int); insert into t3 select 1 union select 1; end| call bug2460_2()| @@ -1681,22 +1669,6 @@ call bug4726()| call bug4726()| drop procedure bug4726| drop table t3| -drop table if exists t3| -create table t3 (s1 int)| -insert into t3 values (3), (4)| -drop procedure if exists bug4318| -create procedure bug4318() -handler t3 read next| -handler t3 open| -call bug4318()| -s1 -3 -call bug4318()| -s1 -4 -handler t3 close| -drop procedure bug4318| -drop table t3| drop procedure if exists bug4902| create procedure bug4902() begin @@ -2302,22 +2274,110 @@ show procedure status like 'bar'| Db Name Type Definer Modified Created Security_type Comment test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 drop procedure bar| -drop table t1; -drop table t2; -drop procedure if exists p1; -create procedure p1 () select (select s1 from t1) from t1; -create table t1 (s1 int); -call p1(); -(select s1 from t1) -insert into t1 values (1); -call p1(); -(select s1 from t1) +drop procedure if exists p1| +create procedure p1 () +select (select s1 from t3) from t3| +create table t3 (s1 int)| +call p1()| +(select s1 from t3) +insert into t3 values (1)| +call p1()| +(select s1 from t3) 1 -drop procedure p1; -drop table t1; -drop function if exists foo; -create function `foo` () returns int return 5; -select `foo` (); +drop procedure p1| +drop table t3| +drop function if exists foo| +create function `foo` () returns int +return 5| +select `foo` ()| `foo` () 5 -drop function `foo`; +drop function `foo`| +drop function if exists t1max| +Warnings: +Note 1305 FUNCTION t1max does not exist +create function t1max() returns int +begin +declare x int; +select max(data) into x from t1; +return x; +end| +insert into t1 values ("foo", 3), ("bar", 2), ("zip", 5), ("zap", 1)| +select t1max()| +t1max() +5 +drop function t1max| +drop table if exists t3| +create table t3 ( +v char(16) not null primary key, +c int unsigned not null +)| +create function getcount(s char(16)) returns int +begin +declare x int; +select count(*) into x from t3 where v = s; +if x = 0 then +insert into t3 values (s, 1); +else +update t3 set c = c+1 where v = s; +end if; +return x; +end| +select * from t1 where data = getcount("bar")| +id data +zap 1 +select * from t3| +v c +bar 4 +select getcount("zip")| +getcount("zip") +0 +select getcount("zip")| +getcount("zip") +1 +select * from t3| +v c +bar 4 +zip 2 +select getcount(id) from t1 where data = 3| +getcount(id) +0 +select getcount(id) from t1 where data = 5| +getcount(id) +1 +select * from t3| +v c +bar 4 +zip 3 +foo 1 +drop table t3| +drop function getcount| +drop function if exists bug5240| +create function bug5240 () returns int +begin +declare x int; +declare c cursor for select data from t1 limit 1; +open c; +fetch c into x; +close c; +return x; +end| +delete from t1| +insert into t1 values ("answer", 42)| +select id, bug5240() from t1| +id bug5240() +42 42 +drop function bug5240| +drop function if exists bug5278| +create function bug5278 () returns char +begin +SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass'); +return 'okay'; +end| +select bug5278()| +ERROR 42000: Can't find any matching row in the user table +select bug5278()| +ERROR 42000: Can't find any matching row in the user table +drop function bug5278| +drop table t1; +drop table t2; |