From f8b7968e049fe115d97181d77c10ba4ca6893744 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Feb 2003 17:41:21 +0100 Subject: [PATCH] Added another select into test. mysql-test/r/sp.result: Added another test for select into (mixed variable types), and made into_test independent of previous tests. mysql-test/t/sp.test: Added another test for select into (mixed variable types), and made into_test independent of previous tests. --- mysql-test/r/sp.result | 31 ++++++++++++++++++++----------- mysql-test/t/sp.test | 26 +++++++++++++++++++------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index ef6bca0f976..35b35e91777 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -137,14 +137,17 @@ insert into test.t1 values ("h1", x); else insert into test.t1 values ("h?", x); end case; -create procedure into_test() +create procedure into_test(x char(16), y int) begin -declare x char(16); -declare y int; -set x="aaaaa"; -set y=22; -select id,data into x,y from test.t1 limit 2,1; insert into test.t1 values (x, y); +select id,data into x,y from test.t1 limit 1; +insert into test.t1 values (concat(x, "2"), y+2); +end; +create procedure into_test2(x char(16), y int) +begin +insert into test.t1 values (x, y); +select id,data into x,@z from test.t1 limit 1; +insert into test.t1 values (concat(x, "2"), y+2); end; call foo42(); select * from t1; @@ -258,13 +261,18 @@ id data h0 0 h1 1 h? 17 -call into_test(); +delete from t1; +call into_test("into", 100); select * from t1; id data -h0 0 -h1 1 -h? 17 -h? 17 +into 100 +into2 102 +delete from t1; +call into_test2("into", 100); +select id,data,@z from t1; +id data @z +into 100 100 +into2 102 100 delete from t1; drop procedure foo42; drop procedure bar; @@ -288,4 +296,5 @@ drop procedure f; drop procedure g; drop procedure h; drop procedure into_test; +drop procedure into_test2; drop table t1; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 79eb088aa2d..48919ff1d6e 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -205,14 +205,19 @@ else insert into test.t1 values ("h?", x); end case| -create procedure into_test() +create procedure into_test(x char(16), y int) begin - declare x char(16); - declare y int; - set x="aaaaa"; - set y=22; - select id,data into x,y from test.t1 limit 2,1; insert into test.t1 values (x, y); + select id,data into x,y from test.t1 limit 1; + insert into test.t1 values (concat(x, "2"), y+2); +end| + +# Test INTO with a mix of local and global variables +create procedure into_test2(x char(16), y int) +begin + insert into test.t1 values (x, y); + select id,data into x,@z from test.t1 limit 1; + insert into test.t1 values (concat(x, "2"), y+2); end| delimiter ;| @@ -291,10 +296,16 @@ call h(0); call h(1); call h(17); select * from t1; -call into_test(); +delete from t1; + +call into_test("into", 100); select * from t1; delete from t1; +call into_test2("into", 100); +select id,data,@z from t1; +delete from t1; + drop procedure foo42; drop procedure bar; drop procedure two; @@ -317,5 +328,6 @@ drop procedure f; drop procedure g; drop procedure h; drop procedure into_test; +drop procedure into_test2; drop table t1;