List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:September 12 2007 7:24pm
Subject:bk commit into 5.0 tree (davi:1.2524) BUG#29223
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of davi. When davi 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/installing-source-tree.html

ChangeSet@stripped, 2007-09-12 16:24:47-03:00, davi@stripped +4 -0
  Bug#29223 declare cursor c for SHOW .....
    
  Disallow declaring cursors for non-SELECT statements (status commands).
  This was never a supported feature and could turn out to be a burden
  later if we ever need/decide to change how status commands works (show
  tables, etc).

  mysql-test/r/sp-error.result@stripped, 2007-09-12 16:24:42-03:00, davi@stripped +11 -0
    Add test case result for Bug#29223

  mysql-test/t/information_schema.test@stripped, 2007-09-12 16:24:42-03:00, davi@stripped +1 -1
    Only SELECT statements are allowed in cursors.

  mysql-test/t/sp-error.test@stripped, 2007-09-12 16:24:42-03:00, davi@stripped +21 -0
    Add test case for Bug#29223

  sql/sql_yacc.yy@stripped, 2007-09-12 16:24:42-03:00, davi@stripped +2 -1
    Only allow declaring cursors for SELECT statements to avoid
    possible further confusion/problems.

diff -Nrup a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
--- a/mysql-test/r/sp-error.result	2007-06-22 06:55:46 -03:00
+++ b/mysql-test/r/sp-error.result	2007-09-12 16:24:42 -03:00
@@ -1452,3 +1452,14 @@ end
 until true end repeat retry;
 end//
 ERROR 42000: LEAVE with no matching label: retry
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE c char(100);
+DECLARE cur1 CURSOR FOR SHOW TABLES;
+OPEN cur1;
+FETCH cur1 INTO c;
+select c;
+CLOSE cur1;
+END|
+ERROR 42000: Cursor statement must be a SELECT
diff -Nrup a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
--- a/mysql-test/t/information_schema.test	2007-08-20 03:23:06 -03:00
+++ b/mysql-test/t/information_schema.test	2007-09-12 16:24:42 -03:00
@@ -949,7 +949,7 @@ BEGIN
   DECLARE col1, col2, col3, col4, col6 CHAR(255);
   DECLARE default_val VARCHAR(65532);
   DECLARE done INT DEFAULT 0;
-  DECLARE cur1 CURSOR FOR SHOW COLUMNS FROM bug23037;
+  DECLARE cur1 CURSOR FOR SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='bug23037';
   DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
   OPEN cur1;
   FETCH cur1 INTO col1, col2, col3, col4, default_val, col6;
diff -Nrup a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
--- a/mysql-test/t/sp-error.test	2007-06-22 06:55:46 -03:00
+++ b/mysql-test/t/sp-error.test	2007-09-12 16:24:42 -03:00
@@ -2090,6 +2090,27 @@ end//
 delimiter ;//
 
 #
+# Bug#29223  declare cursor c for SHOW .....
+#
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+--delimiter |
+--error ER_SP_BAD_CURSOR_QUERY
+CREATE PROCEDURE p1()
+BEGIN
+  DECLARE c char(100);
+  DECLARE cur1 CURSOR FOR SHOW TABLES;
+
+  OPEN cur1;
+  FETCH cur1 INTO c;
+  select c;
+  CLOSE cur1;
+END|
+--delimiter ;
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2007-08-28 14:16:02 -03:00
+++ b/sql/sql_yacc.yy	2007-09-12 16:24:42 -03:00
@@ -2074,7 +2074,8 @@ sp_cursor_stmt:
 	  {
 	    LEX *lex= Lex;
 
-	    if (lex->sql_command != SQLCOM_SELECT)
+	    if (lex->sql_command != SQLCOM_SELECT ||
+	        lex->orig_sql_command != SQLCOM_END)
 	    {
 	      my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY),
                          MYF(0));
Thread
bk commit into 5.0 tree (davi:1.2524) BUG#29223Davi Arnaut12 Sep
  • Re: bk commit into 5.0 tree (davi:1.2524) BUG#29223Marc Alff11 Oct