mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Test suites for engine testing, moved from test-extra so will be available
for general use. mysql-test/Makefile.am: Adding directories of additional test suites mysql-test/mysql-stress-test.pl: Adding check for additional errors checking during test run
This commit is contained in:
50
mysql-test/suite/engines/funcs/r/sp_cursor.result
Normal file
50
mysql-test/suite/engines/funcs/r/sp_cursor.result
Normal file
@ -0,0 +1,50 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
DROP PROCEDURE IF EXISTS sp1;
|
||||
CREATE TABLE t1 (id INTEGER NOT NULL PRIMARY KEY, data INTEGER NULL);
|
||||
CREATE TABLE t2 (i INTEGER NULL);
|
||||
CREATE TABLE t3 (id INTEGER NOT NULL PRIMARY KEY, data INTEGER NULL);
|
||||
INSERT INTO t1 VALUES(1,1),(2,1),(3,4),(4,5);
|
||||
INSERT INTO t2 VALUES(1),(2),(3);
|
||||
CREATE PROCEDURE sp1()
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE a CHAR(16);
|
||||
DECLARE b,c INT;
|
||||
DECLARE cur1 CURSOR FOR SELECT id,data FROM t1;
|
||||
DECLARE cur2 CURSOR FOR SELECT i FROM t2;
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||||
OPEN cur1;
|
||||
OPEN cur2;
|
||||
REPEAT
|
||||
FETCH cur1 INTO a, b;
|
||||
FETCH cur2 INTO c;
|
||||
IF NOT done THEN
|
||||
IF b < c THEN
|
||||
INSERT INTO t3 VALUES (a,b);
|
||||
ELSE
|
||||
INSERT INTO t3 VALUES (a,c);
|
||||
END IF;
|
||||
END IF;
|
||||
UNTIL done END REPEAT;
|
||||
CLOSE cur1;
|
||||
CLOSE cur2;
|
||||
END//
|
||||
CALL sp1();
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
id data
|
||||
1 1
|
||||
2 1
|
||||
3 4
|
||||
4 5
|
||||
SELECT * FROM t2 ORDER BY i;
|
||||
i
|
||||
1
|
||||
2
|
||||
3
|
||||
SELECT * FROM t3 ORDER BY id;
|
||||
id data
|
||||
1 1
|
||||
2 1
|
||||
3 3
|
||||
DROP PROCEDURE sp1;
|
||||
DROP TABLE t1,t2,t3;
|
Reference in New Issue
Block a user