From 96aeecf23780d45cdc9f8663fe8e85c675d23abf Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jul 2004 16:52:17 +0200 Subject: [PATCH] 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. --- mysql-test/r/sp.result | 15 +++++++++++++++ mysql-test/t/sp.test | 22 ++++++++++++++++++++++ sql/sql_yacc.yy | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 17e8e499c8d..ca814c17010 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1427,6 +1427,21 @@ call bug4726()| call bug4726()| drop procedure bug4726| 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| create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index d53cce58767..39f56abb64c 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1653,6 +1653,28 @@ call bug4726()| drop procedure bug4726| 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 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 9458b3830bf..2939090e948 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1713,7 +1713,8 @@ sp_proc_stmt: lex->sql_command == SQLCOM_SHOW_CREATE_FUNC || lex->sql_command == SQLCOM_SHOW_STATUS_PROC || 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 */ lex->sphead->m_multi_results= TRUE;