List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:June 7 2011 3:32pm
Subject:Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162
View as plain text  
On 6/7/11 10:09 AM, Alexander Nozdrin wrote:
> #At file:///home/alik/MySQL/bzr/00/bug55843/mysql-trunk-bug55843-01/ based on
> revid:alexander.nozdrin@stripped
> 
>  3165 Alexander Nozdrin	2011-06-07
>       Pre-requisite patch for Bug#11763162 (55843 - Handled condition
>       appears as not handled).
>       
>       Make THD::stmt_da and THD::warning_info private,
>       and provide getters for them:
>         - THD::get_stmt_da()
>         - THD::set_stmt_da()
>         - THD::get_warning_info()
>         - THD::set_warning_info()
> 

OK to push. Some minor requests below.

> === modified file 'sql/sql_class.h'
> --- a/sql/sql_class.h	2011-05-31 13:52:09 +0000
> +++ b/sql/sql_class.h	2011-06-07 13:09:47 +0000
> @@ -2178,6 +2178,12 @@ public:
>      auto_inc_intervals_forced.append(next_id, ULONGLONG_MAX, 0);
>    }
>  
> +  inline Warning_info *get_warning_info() { return m_warning_info; }
> +  inline void set_warning_info(Warning_info *wi) { m_warning_info= wi; }
> +
> +  inline Diagnostics_area *get_stmt_da() { return m_stmt_da; }
> +  inline void set_stmt_da(Diagnostics_area *da) { m_stmt_da= da; }

Please drop the inline keyword, it's not necessary for member functions
that are defined in the class body. Please also move those closer to the
other functions related to the diagnostics area (ie, clear_error,
is_error, etc).

> === modified file 'sql/table.cc'
> --- a/sql/table.cc	2011-05-26 15:20:09 +0000
> +++ b/sql/table.cc	2011-06-07 13:09:47 +0000
> @@ -3841,20 +3841,20 @@ void TABLE_LIST::hide_view_error(THD *th
>    /* Hide "Unknown column" or "Unknown function" error */
>    DBUG_ASSERT(thd->is_error());
>  
> -  if (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
> -      thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST ||
> -      thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
> -      thd->stmt_da->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
> -      thd->stmt_da->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
> -      thd->stmt_da->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
> -      thd->stmt_da->sql_errno() == ER_TABLE_NOT_LOCKED ||
> -      thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
> +  if (thd->get_stmt_da()->sql_errno() == ER_BAD_FIELD_ERROR ||
> +      thd->get_stmt_da()->sql_errno() == ER_SP_DOES_NOT_EXIST ||
> +      thd->get_stmt_da()->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
> +      thd->get_stmt_da()->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
> +      thd->get_stmt_da()->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
> +      thd->get_stmt_da()->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
> +      thd->get_stmt_da()->sql_errno() == ER_TABLE_NOT_LOCKED ||
> +      thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)

This becomes a bit more unpleasant. Could you please rewrite it into a
switch statement? Patch attached.

Regards,

Davi

=== modified file 'sql/table.cc'
--- sql/table.cc	2011-05-26 15:20:09 +0000
+++ sql/table.cc	2011-06-07 15:25:05 +0000
@@ -3836,19 +3836,30 @@ bool TABLE_LIST::prep_check_option(THD *
 
 void TABLE_LIST::hide_view_error(THD *thd)
 {
+  bool view_is_invalid= false;
+
   if (thd->killed || thd->get_internal_handler())
     return;
   /* Hide "Unknown column" or "Unknown function" error */
   DBUG_ASSERT(thd->is_error());
 
-  if (thd->stmt_da->sql_errno() == ER_BAD_FIELD_ERROR ||
-      thd->stmt_da->sql_errno() == ER_SP_DOES_NOT_EXIST ||
-      thd->stmt_da->sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
-      thd->stmt_da->sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
-      thd->stmt_da->sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
-      thd->stmt_da->sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||
-      thd->stmt_da->sql_errno() == ER_TABLE_NOT_LOCKED ||
-      thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+  bool view_invalid= true;
+
+  switch (thd->stmt_da->sql_errno())
+  {
+  case ER_BAD_FIELD_ERROR:
+  case ER_SP_DOES_NOT_EXIST:
+  case ER_FUNC_INEXISTENT_NAME_COLLISION:
+  case ER_PROCACCESS_DENIED_ERROR:
+  case ER_COLUMNACCESS_DENIED_ERROR:
+  case ER_COLUMNACCESS_DENIED_ERROR:
+  case ER_TABLEACCESS_DENIED_ERROR:
+  case ER_TABLE_NOT_LOCKED:
+  case ER_NO_SUCH_TABLE:
+    view_is_invalid= true;
+  }
+
+  if (view_is_invalid)
   {
     TABLE_LIST *top= top_table();
     thd->clear_error();


Thread
bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162Alexander Nozdrin7 Jun
  • Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162Jon Olav Hauglid7 Jun
    • Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162Alexander Nozdrin8 Jun
  • Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162Davi Arnaut7 Jun
    • Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3165) Bug#11763162Alexander Nozdrin8 Jun