List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:February 7 2008 7:13pm
Subject:bk commit into 6.0 tree (davi:1.2537)
View as plain text  
Below is the list of changes that have just been committed into a local
6.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, 2008-02-07 17:13:31-02:00, davi@stripped +3 -0
  Manual merge of Bug 21801

  mysql-test/r/sp-error.result@stripped, 2008-02-07 17:13:27-02:00, davi@stripped +0 -11
    Update test case result.

  mysql-test/t/sp-error.test@stripped, 2008-02-07 17:13:27-02:00, davi@stripped +16 -14
    Disable test case for Bug#21801, there are no deprecated
    warnings in 6.0 and upwards.

  sql/sp.cc@stripped, 2008-02-07 17:13:27-02:00, davi@stripped +27 -0
    Manual merge of the Silence_deprecated_warning class.

diff -Nrup a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
--- a/mysql-test/r/sp-error.result	2008-02-06 12:54:47 -02:00
+++ b/mysql-test/r/sp-error.result	2008-02-07 17:13:27 -02:00
@@ -1611,14 +1611,3 @@ end loop label1;
 end loop;
 end|
 ERROR 42000: End-label label1 without match
-drop procedure if exists p1;
-create procedure p1()
-begin
-create table t1 (a int) type=MyISAM;
-drop table t1;
-end|
-Warnings:
-Warning	1287	The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 5.2. Please use 'ENGINE=storage_engine' instead
-call p1();
-call p1();
-drop procedure p1;
diff -Nrup a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
--- a/mysql-test/t/sp-error.test	2008-02-06 12:54:48 -02:00
+++ b/mysql-test/t/sp-error.test	2008-02-07 17:13:27 -02:00
@@ -2354,20 +2354,22 @@ delimiter ;|
 #
 # Bug#21801: SQL exception handlers and warnings
 #
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-delimiter |;
-create procedure p1()
-begin
-  create table t1 (a int) type=MyISAM;
-  drop table t1;
-end|
-delimiter ;|
-call p1();
-call p1();
-drop procedure p1;
+# Disabled because there are no deprecated warnings in 6.+
+# Uncomment when such warnings are added to the parser.
+#
+#--disable_warnings
+#drop procedure if exists p1;
+#--enable_warnings
+#delimiter |;
+#create procedure p1()
+#begin
+#  create table t1 (a int) type=MyISAM;
+#  drop table t1;
+#end|
+#delimiter ;|
+#call p1();
+#call p1();
+#drop procedure p1;
 
 #
 # BUG#NNNN: New bug synopsis
diff -Nrup a/sql/sp.cc b/sql/sp.cc
--- a/sql/sp.cc	2008-02-07 16:21:14 -02:00
+++ b/sql/sp.cc	2008-02-07 17:13:27 -02:00
@@ -482,6 +482,30 @@ db_find_routine(THD *thd, int type, sp_n
 }
 
 
+/**
+  Silence DEPRECATED SYNTAX warnings when loading a stored procedure
+  into the cache.
+*/
+struct Silence_deprecated_warning : public Internal_error_handler
+{
+public:
+  virtual bool handle_error(uint sql_errno, const char *message,
+                            MYSQL_ERROR::enum_warning_level level,
+                            THD *thd);
+};
+
+bool
+Silence_deprecated_warning::handle_error(uint sql_errno, const char *message,
+                                         MYSQL_ERROR::enum_warning_level level,
+                                         THD *thd)
+{
+  if (sql_errno == ER_WARN_DEPRECATED_SYNTAX &&
+      level == MYSQL_ERROR::WARN_LEVEL_WARN)
+    return TRUE;
+
+  return FALSE;
+}
+
 
 /**
   @brief    The function parses input strings and returns SP stucture.
@@ -503,12 +527,14 @@ static sp_head *sp_compile(THD *thd, Str
   ulong old_sql_mode= thd->variables.sql_mode;
   ha_rows old_select_limit= thd->variables.select_limit;
   sp_rcontext *old_spcont= thd->spcont;
+  Silence_deprecated_warning warning_handler;
 
   thd->variables.sql_mode= sql_mode;
   thd->variables.select_limit= HA_POS_ERROR;
 
   Lex_input_stream lip(thd, defstr->c_ptr(), defstr->length());
   lex_start(thd);
+  thd->push_internal_handler(&warning_handler);
   thd->spcont= 0;
 
   if (parse_sql(thd, &lip, creation_ctx) || thd->lex == NULL)
@@ -522,6 +548,7 @@ static sp_head *sp_compile(THD *thd, Str
     sp= thd->lex->sphead;
   }
 
+  thd->pop_internal_handler();
   thd->spcont= old_spcont;
   thd->variables.sql_mode= old_sql_mode;
   thd->variables.select_limit= old_select_limit;
Thread
bk commit into 6.0 tree (davi:1.2537)Davi Arnaut7 Feb