1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for BUG#9814: Clear thd->net.no_send_error before each SP instruction

execution. Failure to do so caused the erroneous statements to send nothing
and hang the client.


mysql-test/r/sp-error.result:
  Testcase for BUG#9814. Note that the result demonstrates that currently
  mysql-test-run ignores errors in multi-statement if they arrive after first 
  resultset has been received.
mysql-test/t/sp-error.test:
  Testcase for BUG#09814.
This commit is contained in:
unknown
2005-07-04 23:00:23 +00:00
parent 428830c500
commit b87b32555e
3 changed files with 74 additions and 0 deletions

View File

@ -2,6 +2,10 @@
# Stored PROCEDURE error tests
#
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
# Make sure we don't have any procedures left.
delete from mysql.proc;
@ -933,3 +937,37 @@ create procedure p() execute stmt;
create function f() returns int begin execute stmt;
deallocate prepare stmt;
# BUG#9814: Closing a cursor that is not open
create table t1(f1 int);
create table t2(f1 int);
delimiter |;
CREATE PROCEDURE SP001()
P1: BEGIN
DECLARE ENDTABLE INT DEFAULT 0;
DECLARE TEMP_NUM INT;
DECLARE TEMP_SUM INT;
DECLARE C1 CURSOR FOR SELECT F1 FROM t1;
DECLARE C2 CURSOR FOR SELECT F1 FROM t2;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET ENDTABLE = 1;
SET ENDTABLE=0;
SET TEMP_SUM=0;
SET TEMP_NUM=0;
OPEN C1;
FETCH C1 INTO TEMP_NUM;
WHILE ENDTABLE = 0 DO
SET TEMP_SUM=TEMP_NUM+TEMP_SUM;
FETCH C1 INTO TEMP_NUM;
END WHILE;
SELECT TEMP_SUM;
CLOSE C1;
CLOSE C1;
SELECT 'end of proc';
END P1|
delimiter ;|
call SP001();
drop procedure SP001;
drop table t1, t2;