dbTalk Databases Forums  

bk commit into 5.0 tree (pem:1.1943) BUG#10961

mailing.database.mysql-internals mailing.database.mysql-internals


Discuss bk commit into 5.0 tree (pem:1.1943) BUG#10961 in the mailing.database.mysql-internals forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pem@mysql.com
 
Posts: n/a

Default bk commit into 5.0 tree (pem:1.1943) BUG#10961 - 06-01-2005 , 05:43 AM






Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/in...urce-tree.html

ChangeSet
1.1943 05/06/01 12:18:41 pem (AT) mysql (DOT) comhem.se +4 -0
Fixed BUG#10961: Stored procedures: crash if select * from dual
Have to catch errors from SELECT when opening a cursor.

sql/sp_head.cc
1.141 05/06/01 12:17:38 pem (AT) mysql (DOT) com +13 -1
Catch "hidden" errors during SELECT when opening a cursor.

sql/protocol.h
1.28 05/06/01 12:17:38 pem (AT) mysql (DOT) com +2 -2
Init data in Protocol_cursor constructor, for error cases.

mysql-test/t/sp.test
1.120 05/06/01 12:17:38 pem (AT) mysql (DOT) com +29 -0
New test case for BUG#10961.

mysql-test/r/sp.result
1.126 05/06/01 12:17:38 pem (AT) mysql (DOT) com +29 -0
New test case for BUG#10961.

# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pem
# Host: mysql.comhem.se
# Root: /home/pem/work/mysql-5.0

--- 1.27/sql/protocol.h Mon May 9 11:26:47 2005
+++ 1.28/sql/protocol.h Wed Jun 1 12:17:38 2005
@@ -159,8 +159,8 @@
MYSQL_ROWS **prev_record;
ulong row_count;

- Protocol_cursor() {}
- Protocol_cursor(THD *thd_arg, MEM_ROOT *ini_alloc) :Protocol_simple(thd_arg), alloc(ini_alloc) {}
+ Protocol_cursor() :data(NULL) {}
+ Protocol_cursor(THD *thd_arg, MEM_ROOT *ini_alloc) :Protocol_simple(thd_arg), alloc(ini_alloc), data(NULL) {}
bool prepare_for_send(List<Item> *item_list)
{
row_count= 0;

--- 1.125/mysql-test/r/sp.result Fri May 27 14:48:27 2005
+++ 1.126/mysql-test/r/sp.result Wed Jun 1 12:17:38 2005
@@ -3109,4 +3109,33 @@
bug9559()
-3
drop function bug9559|
+drop procedure if exists bug10961|
+create procedure bug10961()
+begin
+declare v char;
+declare x int;
+declare c cursor for select * from dual;
+declare continue handler for sqlexception select x;
+set x = 1;
+open c;
+set x = 2;
+fetch c into v;
+set x = 3;
+close c;
+end|
+call bug10961()|
+x
+1
+x
+2
+x
+3
+call bug10961()|
+x
+1
+x
+2
+x
+3
+drop procedure bug10961|
drop table t1,t2;

--- 1.119/mysql-test/t/sp.test Fri May 27 14:48:27 2005
+++ 1.120/mysql-test/t/sp.test Wed Jun 1 12:17:38 2005
@@ -3801,6 +3801,7 @@
drop procedure bug5963_2|
drop table t3|

+
#
# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
# results.
@@ -3818,6 +3819,34 @@
select bug9559()|

drop function bug9559|
+
+
+#
+# BUG#10961: Stored procedures: crash if select * from dual
+#
+--disable_warnings
+drop procedure if exists bug10961|
+--enable_warnings
+# "select * from dual" results in an error, so the cursor will not open
+create procedure bug10961()
+begin
+ declare v char;
+ declare x int;
+ declare c cursor for select * from dual;
+ declare continue handler for sqlexception select x;
+
+ set x = 1;
+ open c;
+ set x = 2;
+ fetch c into v;
+ set x = 3;
+ close c;
+end|
+
+call bug10961()|
+call bug10961()|
+
+drop procedure bug10961|


#

--- 1.140/sql/sp_head.cc Tue May 31 12:06:09 2005
+++ 1.141/sql/sp_head.cc Wed Jun 1 12:17:38 2005
@@ -1913,7 +1913,19 @@
else
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);

- c->post_open(thd, (lex_keeper ? TRUE : FALSE));
+ /*
+ Work around the fact that errors in selects are not returned properly
+ (but instead converted into a warning), so if a condition handler
+ caught, we have lost the result code.
+ */
+ if (!res)
+ {
+ uint dummy1, dummy2;
+
+ if (thd->spcont->found_handler(&dummy1, &dummy2))
+ res= -1;
+ }
+ c->post_open(thd, (lex_keeper && !res ? TRUE : FALSE));
}

DBUG_RETURN(res);

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?uns...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.