diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-20 13:29:11 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-20 13:29:11 +0400 |
commit | 9c53cbdd8887f0f8bcdade24a4be183a3b354bc9 (patch) | |
tree | 0301dfd03a919bb961f021df0eb2e37b817aaa9d /mysql-test/main/sp-cursor.result | |
parent | b534a7b89ef39cd75bfe09524be044bc16ea2f48 (diff) | |
download | mariadb-git-9c53cbdd8887f0f8bcdade24a4be183a3b354bc9.tar.gz |
MDEV-15941 Explicit cursor FOR loop does not close the cursor
Diffstat (limited to 'mysql-test/main/sp-cursor.result')
-rw-r--r-- | mysql-test/main/sp-cursor.result | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result index 1f8cb7f0635..42d6e455109 100644 --- a/mysql-test/main/sp-cursor.result +++ b/mysql-test/main/sp-cursor.result @@ -611,3 +611,76 @@ a b a b 2 b2 DROP TABLE t1; +# +# MDEV-15941 Explicit cursor FOR loop does not close the cursor +# +BEGIN NOT ATOMIC +DECLARE v INT; +DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL; +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +FETCH cur INTO v; +END; +$$ +rec.a +1 +ERROR 24000: Cursor is not open +BEGIN NOT ATOMIC +DECLARE v INT; +DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL; +label: +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +FETCH cur INTO v; +END; +$$ +rec.a +1 +ERROR 24000: Cursor is not open +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL; +OPEN cur; +FOR rec IN cur DO +SELECT rec.a; +END FOR; +END; +$$ +ERROR 24000: Cursor is already open +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL; +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +END; +$$ +rec.a +1 +rec.a +1 +BEGIN NOT ATOMIC +DECLARE cur CURSOR FOR SELECT 1 AS a FROM DUAL; +label1: +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +label2: +FOR rec IN cur +DO +SELECT rec.a; +END FOR; +END; +$$ +rec.a +1 +rec.a +1 |