List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:June 9 2011 8:42pm
Subject:Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3172) Bug#11763162
View as plain text  
Hi,

On 6/9/11 6:36 AM, Alexander Nozdrin wrote:
> #At file:///home/alik/MySQL/bzr/00/bug55843/mysql-trunk-bug55843-03/ based on
> revid:alexander.nozdrin@stripped
> 
>  3172 Alexander Nozdrin	2011-06-09
>       Pre-requisite patch for Bug#11763162 (55843 - Handled condition
>       appears as not handled).
>       
>       The goal of this patch is to change the relationship between THD,
>       Diagnostics_area and Warning_info classes:
>       
>         - before the patch, THD owned both Diagnostics_area and
>           Warning_info instances.
>       
>         - after the patch THD owns Diagnostics_area instance,
>           and Diagnostics_area owns Warning_info instance.
>       
>       The patch changes THD::get_warning_info() and THD::set_warning_info(),
>       so that they still work to minimize side changes.
>       
>       Those functions will be removed later in a separate patch.
>       

Looks good. One minor comment below.

> 
>     modified:
>       sql/sql_class.cc
>       sql/sql_class.h
>       sql/sql_error.cc
>       sql/sql_error.h
>       sql/sql_prepare.cc
>       sql/sql_prepare.h
> === modified file 'sql/sql_class.cc'
> --- a/sql/sql_class.cc	2011-06-09 08:58:41 +0000
> +++ b/sql/sql_class.cc	2011-06-09 09:36:20 +0000
> @@ -753,8 +753,7 @@ THD::THD(bool enable_plugins)
>     debug_sync_control(0),
>  #endif /* defined(ENABLED_DEBUG_SYNC) */
>     m_enable_plugins(enable_plugins),
> -   main_warning_info(0, false),
> -   m_warning_info(&main_warning_info),
> +   main_da(0, false),
>     m_stmt_da(&main_da)
>  {
>    ulong tmp;
> 
> === modified file 'sql/sql_class.h'
> --- a/sql/sql_class.h	2011-06-09 08:58:41 +0000
> +++ b/sql/sql_class.h	2011-06-09 09:36:20 +0000
> @@ -2834,7 +2834,7 @@ public:
>  
>    /// Returns Warning-information-area for the current statement.
>    Warning_info *get_warning_info()
> -  { return m_warning_info; }
> +  { return get_stmt_da()->get_warning_info(); }
>  
>    /// Returns Warning-information-area for the current statement.
>    const Warning_info *get_warning_info() const
> @@ -2842,7 +2842,7 @@ public:
>  
>    /// Sets Warning-information-area for the current statement.
>    void set_warning_info(Warning_info *wi)
> -  { m_warning_info= wi; }
> +  { get_stmt_da()->set_warning_info(wi); }
>  
>    /// Returns Diagnostics-area for the current statement.
>    Diagnostics_area *get_stmt_da()
> @@ -3247,10 +3247,7 @@ private:
>      tree itself is reused between executions and thus is stored elsewhere.
>    */
>    MEM_ROOT main_mem_root;
> -  Warning_info main_warning_info;
>    Diagnostics_area main_da;
> -
> -  Warning_info *m_warning_info;
>    Diagnostics_area *m_stmt_da;
>  
>    /**
> 
> === modified file 'sql/sql_error.cc'
> --- a/sql/sql_error.cc	2011-06-09 08:58:41 +0000
> +++ b/sql/sql_error.cc	2011-06-09 09:36:20 +0000
> @@ -318,6 +318,23 @@ MYSQL_ERROR::set_sqlstate(const char* sq
>    m_returned_sqlstate[SQLSTATE_LENGTH]= '\0';
>  }
>  
> +Diagnostics_area::Diagnostics_area()
> +:
> +  m_main_wi(0, false),

Style should be:

Diagnostics_area::Diagnostics_area()
 : m_main_wi(0, false),
   m_current_wi(&m_main_wi)

See MYSQL_ERROR's constructor for an example.

> +  m_current_wi(&m_main_wi)
> +{
> +  reset_diagnostics_area();
> +}
> +
> +Diagnostics_area::Diagnostics_area(ulonglong warn_id,
> +                                   bool allow_unlimited_warnings)
> +:
> +  m_main_wi(warn_id, allow_unlimited_warnings),
> +  m_current_wi(&m_main_wi)
> +{
> +  reset_diagnostics_area();
> +}
> +
>  /**
>    Clear this diagnostics area.
>  
> 
> === modified file 'sql/sql_error.h'
> --- a/sql/sql_error.h	2011-06-09 09:03:18 +0000
> +++ b/sql/sql_error.h	2011-06-09 09:36:20 +0000
> @@ -485,7 +485,19 @@ public:
>      return m_statement_warn_count;
>    }
>  
> -  Diagnostics_area() { reset_diagnostics_area(); }
> +public:
> +  Diagnostics_area();
> +  Diagnostics_area(ulonglong warn_id, bool allow_unlimited_warnings);
> +
> +public:
> +  inline Warning_info *get_warning_info()
> +  { return m_current_wi; }
> +
> +  inline const Warning_info *get_warning_info() const
> +  { return m_current_wi; }

:-)

OK to push.

Regards,

Davi
Thread
bzr commit into mysql-trunk branch (alexander.nozdrin:3172) Bug#11763162Alexander Nozdrin9 Jun
  • Re: bzr commit into mysql-trunk branch (alexander.nozdrin:3172) Bug#11763162Davi Arnaut10 Jun