Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/multiple_resultsets_and_out_params.test |
## generated ## Test multiple resultsets and SP output params ## Preamble --source ../include/xplugin_preamble.inc ## Test starts here --write_file $MYSQL_TMP_DIR/multiple_resultsets_and_out_params.tmp -->sql create schema xtest; use xtest; CREATE TABLE tab_1 (c1t1 INT UNSIGNED, c2t1 VARCHAR(10)); INSERT INTO tab_1 VALUES (1, "ONE"), (2, "TWO"), (3, "THREE"); CREATE TABLE tab_2 (c1t2 DATETIME); INSERT INTO tab_2 VALUES ('2006-07-03'), ('2013-06-15'), ('2012-11-24'), ('1979-11-24'); DELIMITER // CREATE PROCEDURE empty() BEGIN END // CREATE PROCEDURE one_results_set() BEGIN SELECT * FROM tab_1; END // CREATE PROCEDURE three_results_sets() BEGIN SELECT * FROM tab_1; SELECT * FROM tab_2; CALL one_results_set(); END // CREATE PROCEDURE out_param_no_select(IN val INT, OUT res INT) BEGIN SET res = 2 * val; END // CREATE PROCEDURE out_params_with_select(OUT min_val DATETIME, OUT max_val DATETIME) BEGIN SELECT MIN(c1t2) INTO min_val FROM tab_2; SELECT MAX(c1t2) INTO max_val FROM tab_2; SELECT * FROM tab_1; END // CREATE PROCEDURE update_no_select() BEGIN UPDATE tab_1 SET c1t1 = c1t1 + 1 WHERE c1t1 > 1; END // CREATE PROCEDURE update_and_select() BEGIN UPDATE tab_1 SET c1t1 = c1t1 + 2 WHERE c1t1 > 2; SELECT * FROM tab_1; END // CREATE PROCEDURE update_and_out_param(OUT max_val INT) BEGIN UPDATE tab_1 SET c1t1 = c1t1 + 2 ORDER BY c1t1 LIMIT 1; SELECT MAX(c1t1) into max_val FROM tab_1; END // CREATE PROCEDURE update_and_out_param_and_select(OUT max_val INT) BEGIN UPDATE tab_1 SET c1t1 = c1t1 * 2 ORDER BY c1t1 DESC LIMIT 1; SELECT MAX(c1t1) into max_val FROM tab_1; SELECT AVG(c1t1) FROM tab_1; END // CREATE PROCEDURE insert_no_select() BEGIN INSERT INTO tab_1 VALUES (11, "s11"), (12, "s12"), (13, "s13"); END // CREATE PROCEDURE insert_and_select() BEGIN INSERT INTO tab_1 VALUES (111, "s111"), (112, "s112"), (13, "s113"); SELECT * FROM tab_1; END // CREATE PROCEDURE insert_and_out_param(OUT max_val INT) BEGIN INSERT INTO tab_1 VALUES(9999, "BIG ONE"); SELECT MAX(c1t1) into max_val FROM tab_1; END // CREATE PROCEDURE insert_and_out_param_and_select(OUT max_val INT) BEGIN INSERT INTO tab_1 VALUES(19999, "BIGER ONE"); SELECT MAX(c1t1) into max_val FROM tab_1; SELECT MIN(c1t1) FROM tab_1; END // CREATE PROCEDURE error() BEGIN SELECT * FROM tab_not_existing; END // CREATE PROCEDURE select_and_error() BEGIN SELECT * FROM tab_1; SELECT * FROM tab_not_existing; END // CREATE PROCEDURE out_param_and_error(OUT min_val INT) BEGIN SELECT MIN(c1t1) INTO min_val FROM tab_1; SELECT * FROM tab_not_existing; END // CREATE PROCEDURE select_out_param_and_error(OUT min_val INT) BEGIN SELECT MIN(c1t1) INTO min_val FROM tab_1; SELECT COUNT(c1t1) FROM tab_1; SELECT * FROM tab_not_existing; END // CREATE PROCEDURE with_warning() BEGIN DECLARE tiny TINYINT; SET tiny = 9000; END // CREATE PROCEDURE select_and_warning() BEGIN DECLARE tiny TINYINT; SELECT * FROM tab_2; SET tiny = 9000; END // CREATE PROCEDURE out_param_and_warning(OUT vavg FLOAT) BEGIN DECLARE tiny TINYINT; SELECT AVG(c1t1) INTO vavg FROM tab_1; SET tiny = 9000; END // CREATE PROCEDURE select_out_param_and_warning(OUT min_val INT) BEGIN DECLARE c CHAR(2); SELECT MIN(c1t1) INTO min_val FROM tab_1; SELECT COUNT(c1t1) FROM tab_1; SET c = "TOO LONG"; END // DELIMITER ; CALL empty(); CALL one_results_set(); CALL three_results_sets(); CALL out_param_no_select(5,@res); CALL out_params_with_select(@min_val, @max_val); SELECT @res, @min_val, @max_val; CALL update_no_select(); CALL update_and_select(); CALL update_and_out_param(@max_val); SELECT @max_val; CALL update_and_out_param_and_select(@max_val); SELECT @max_val; CALL insert_no_select(); CALL insert_and_select(); CALL insert_and_out_param(@max_val); SELECT @max_val; CALL insert_and_out_param_and_select(@max_val); SELECT @max_val; -->endsql -->expecterror 1146 -->sql CALL error(); -->endsql -->expecterror 1146 -->sql CALL select_and_error(); -->endsql -->expecterror 1146 -->sql CALL out_param_and_error(@min_val); SELECT @min_val; -->endsql -->expecterror 1146 -->sql CALL select_out_param_and_error(@min_val); SELECT @min_val; -->endsql -->expecterror 1264 -->sql CALL with_warning(); SHOW WARNINGS; -->endsql -->expecterror 1264 -->sql CALL select_and_warning(); SHOW WARNINGS; -->endsql -->expecterror 1264 -->sql CALL out_param_and_warning(@vavg); SHOW WARNINGS; SELECT @vavg; -->endsql -->expecterror 1406 -->sql CALL select_out_param_and_warning(@min_val); SHOW WARNINGS; SELECT @min_val; drop schema if exists xtest; -->endsql EOF --exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/multiple_resultsets_and_out_params.tmp 2>&1 --remove_file $MYSQL_TMP_DIR/multiple_resultsets_and_out_params.tmp ## Postamble uninstall plugin mysqlx;