Commit 96aeecf2 authored by unknown's avatar unknown

Fixed BUG#4318: Stored Procedure packet error if HANDLER statement,

at least partially. It doesn't crash or give packets out of order
any more, but it's unclear why it doesn't actually return anything
from within an SP. This should be investigated at some point, but
for the moment this will have to do. (It is a rather obscure feature... :)


mysql-test/r/sp.result:
  Test case for BUG#4318.
mysql-test/t/sp.test:
  Test case for BUG#4318.
sql/sql_yacc.yy:
  Recognize HANDLER READ as another statement that might result in multiple results.
parent 26c755ab
...@@ -1427,6 +1427,21 @@ call bug4726()| ...@@ -1427,6 +1427,21 @@ call bug4726()|
call bug4726()| call bug4726()|
drop procedure bug4726| drop procedure bug4726|
drop table t3| drop table t3|
drop table if exists t3|
create table t3 (s1 int)|
insert into t3 values (3), (4)|
create procedure bug4318()
handler t3 read next|
handler t3 open|
call bug4318()|
s1
3
call bug4318()|
s1
4
handler t3 close|
drop procedure bug4318|
drop table t3|
drop table if exists fac| drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)| create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned) create procedure ifac(n int unsigned)
......
...@@ -1653,6 +1653,28 @@ call bug4726()| ...@@ -1653,6 +1653,28 @@ call bug4726()|
drop procedure bug4726| drop procedure bug4726|
drop table t3| drop table t3|
#
# BUG#4318
#
--disable_warnings
drop table if exists t3|
--enable_warnings
create table t3 (s1 int)|
insert into t3 values (3), (4)|
create procedure bug4318()
handler t3 read next|
handler t3 open|
# Expect no results, as tables are closed, but there shouldn't be any errors
call bug4318()|
call bug4318()|
handler t3 close|
drop procedure bug4318|
drop table t3|
# #
# Some "real" examples # Some "real" examples
......
...@@ -1713,7 +1713,8 @@ sp_proc_stmt: ...@@ -1713,7 +1713,8 @@ sp_proc_stmt:
lex->sql_command == SQLCOM_SHOW_CREATE_FUNC || lex->sql_command == SQLCOM_SHOW_CREATE_FUNC ||
lex->sql_command == SQLCOM_SHOW_STATUS_PROC || lex->sql_command == SQLCOM_SHOW_STATUS_PROC ||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC || lex->sql_command == SQLCOM_SHOW_STATUS_FUNC ||
lex->sql_command == SQLCOM_ANALYZE) lex->sql_command == SQLCOM_ANALYZE ||
lex->sql_command == SQLCOM_HA_READ)
{ {
/* We maybe have one or more SELECT without INTO */ /* We maybe have one or more SELECT without INTO */
lex->sphead->m_multi_results= TRUE; lex->sphead->m_multi_results= TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment