List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:July 29 2009 2:56pm
Subject:bzr commit into mysql-5.4 branch (roy.lyseng:2835)
View as plain text  
#At file:///home/rl136806/mysql/repo/mysql-reeng-roy/ based on revid:alik@stripped

 2835 Roy Lyseng	2009-07-29
      Preparing for extension of the SQL command class hierarchy. Rename of existing classes.
       - Rename class SQLCOM_statement to Sql_statement.
       - Rename class Abstract_signal to Signal_common.
       - Rename class SQLCOM_signal to Signal_statement.
       - Rename class SQLCOM_resignal to Resignal_statement.
      
      In addition, the return value of Sql_statement::execute() is changed from int to bool.
     @ sql/sql_class.h
        Rename of classes.
     @ sql/sql_error.cc
        Rename of classes.
     @ sql/sql_error.h
        Rename of classes.
     @ sql/sql_lex.h
        Rename of classes.
     @ sql/sql_signal.cc
        Rename of classes.
        Changed return value of execute() to bool.
     @ sql/sql_signal.h
        Rename of classes.
        Changed return value.
     @ sql/sql_yacc.yy
        Rename of classes.
        Lines longer than 80 characters shortened.

    modified:
      sql/sql_class.h
      sql/sql_error.cc
      sql/sql_error.h
      sql/sql_lex.h
      sql/sql_signal.cc
      sql/sql_signal.h
      sql/sql_yacc.yy
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-07-10 12:31:32 +0000
+++ b/sql/sql_class.h	2009-07-29 14:56:38 +0000
@@ -2420,9 +2420,9 @@ private:
     To raise a SQL condition, the code should use the public
     raise_error() or raise_warning() methods provided by class THD.
   */
-  friend class Abstract_signal;
-  friend class SQLCOM_signal;
-  friend class SQLCOM_resignal;
+  friend class Signal_common;
+  friend class Signal_statement;
+  friend class Resignal_statement;
   friend void push_warning(THD*, MYSQL_ERROR::enum_warning_level, uint, const char*);
   friend void my_message_sql(uint, const char *, myf);
 

=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc	2009-07-03 05:54:09 +0000
+++ b/sql/sql_error.cc	2009-07-29 14:56:38 +0000
@@ -153,7 +153,7 @@ This file contains the implementation of
   This is implemented by using 'String MYSQL_ERROR::m_message_text'.
 
   The UTF8 -> error_message_charset_info conversion is implemented in
-  Abstract_signal::eval_signal_informations() (for path #B and #C).
+  Signal_common::eval_signal_informations() (for path #B and #C).
 
   Future work
   -----------

=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h	2009-07-03 05:54:09 +0000
+++ b/sql/sql_error.h	2009-07-29 14:56:38 +0000
@@ -213,9 +213,9 @@ private:
   */
   friend class THD;
   friend class Warning_info;
-  friend class Abstract_signal;
-  friend class SQLCOM_signal;
-  friend class SQLCOM_resignal;
+  friend class Signal_common;
+  friend class Signal_statement;
+  friend class Resignal_statement;
   friend class sp_rcontext;
 
   /**
@@ -512,7 +512,7 @@ private:
   /** Read only status. */
   bool m_read_only;
 
-  friend class SQLCOM_resignal;
+  friend class Resignal_statement;
 };
 
 ///////////////////////////////////////////////////////////////////////////

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2009-07-21 14:57:51 +0000
+++ b/sql/sql_lex.h	2009-07-29 14:56:38 +0000
@@ -1549,18 +1549,18 @@ public:
 /**
   Abstract representation of a statement.
   This class is an interface between the parser and the runtime.
-  The parser builds the appropriate sub classes of SQLCOM_statement
+  The parser builds the appropriate sub classes of Sql_statement
   to represent a SQL statement in the parsed tree.
   The execute() method in the sub classes contain the runtime implementation.
   Note that this interface is used for SQL statement recently implemented,
   the code for older statements tend to load the LEX structure with more
   attributes instead.
   The recommended way to implement new statements is to sub-class
-  SQLCOM_statement, as this improves code modularity (see the 'big switch' in
+  Sql_statement, as this improves code modularity (see the 'big switch' in
   dispatch_command()), and decrease the total size of the LEX structure
   (therefore saving memory in stored programs).
 */
-class SQLCOM_statement : public Sql_alloc
+class Sql_statement : public Sql_alloc
 {
 public:
   /**
@@ -1568,22 +1568,22 @@ public:
     @param thd the current thread.
     @return 0 on success.
   */
-  virtual int execute(THD *thd) = 0;
+  virtual bool execute(THD *thd) = 0;
 
 protected:
   /**
     Constructor.
     @param lex the LEX structure that represents parts of this statement.
   */
-  SQLCOM_statement(struct LEX *lex)
+  Sql_statement(struct LEX *lex)
     : m_lex(lex)
   {}
 
   /** Destructor. */
-  virtual ~SQLCOM_statement()
+  virtual ~Sql_statement()
   {
     /*
-      SQLCOM_statement objects are allocated in thd->mem_root.
+      Sql_statement objects are allocated in thd->mem_root.
       In MySQL, the C++ destructor is never called, the underlying MEM_ROOT is
       simply destroyed instead.
       Do not rely on the destructor for any cleanup.
@@ -1596,7 +1596,7 @@ protected:
     The legacy LEX structure for this statement.
     The LEX structure contains the existing properties of the parsed tree.
     TODO: with time, attributes from LEX should move to sub classes of
-    SQLCOM_statement, so that the parser only builds SQLCOM_statement objects
+    Sql_statement, so that the parser only builds Sql_statement objects
     with the minimum set of attributes, instead of a LEX structure that
     contains the collection of every possible attribute.
   */
@@ -1707,7 +1707,7 @@ struct LEX: public Query_tables_list
   nesting_map allow_sum_func;
   enum_sql_command sql_command;
 
-  SQLCOM_statement *m_stmt;
+  Sql_statement *m_stmt;
 
   /*
     Usually `expr` rule of yacc is quite reused but some commands better

=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc	2009-02-06 03:25:50 +0000
+++ b/sql/sql_signal.cc	2009-07-29 14:56:38 +0000
@@ -91,10 +91,10 @@ void Set_signal_information::clear()
   memset(m_item, 0, sizeof(m_item));
 }
 
-void Abstract_signal::assign_defaults(MYSQL_ERROR *cond,
-                                      bool set_level_code,
-                                      MYSQL_ERROR::enum_warning_level level,
-                                      int sqlcode)
+void Signal_common::assign_defaults(MYSQL_ERROR *cond,
+                                    bool set_level_code,
+                                    MYSQL_ERROR::enum_warning_level level,
+                                    int sqlcode)
 {
   if (set_level_code)
   {
@@ -105,7 +105,7 @@ void Abstract_signal::assign_defaults(MY
     cond->set_builtin_message_text(ER(sqlcode));
 }
 
-void Abstract_signal::eval_defaults(THD *thd, MYSQL_ERROR *cond)
+void Signal_common::eval_defaults(THD *thd, MYSQL_ERROR *cond)
 {
   DBUG_ASSERT(cond);
 
@@ -260,7 +260,7 @@ static int assign_condition_item(MEM_ROO
 }
 
 
-int Abstract_signal::eval_signal_informations(THD *thd, MYSQL_ERROR *cond)
+int Signal_common::eval_signal_informations(THD *thd, MYSQL_ERROR *cond)
 {
   struct cond_item_map
   {
@@ -292,7 +292,7 @@ int Abstract_signal::eval_signal_informa
   String *member;
   const LEX_STRING *name;
 
-  DBUG_ENTER("Abstract_signal::eval_signal_informations");
+  DBUG_ENTER("Signal_common::eval_signal_informations");
 
   for (i= FIRST_DIAG_SET_PROPERTY;
        i <= LAST_DIAG_SET_PROPERTY;
@@ -418,11 +418,11 @@ end:
   DBUG_RETURN(result);
 }
 
-int Abstract_signal::raise_condition(THD *thd, MYSQL_ERROR *cond)
+bool Signal_common::raise_condition(THD *thd, MYSQL_ERROR *cond)
 {
-  int result= 1;
+  bool result= TRUE;
 
-  DBUG_ENTER("Abstract_signal::raise_condition");
+  DBUG_ENTER("Signal_common::raise_condition");
 
   DBUG_ASSERT(m_lex->query_tables == NULL);
 
@@ -445,18 +445,18 @@ int Abstract_signal::raise_condition(THD
   if (cond->m_level == MYSQL_ERROR::WARN_LEVEL_WARN)
   {
     my_ok(thd);
-    result= 0;
+    result= FALSE;
   }
 
   DBUG_RETURN(result);
 }
 
-int SQLCOM_signal::execute(THD *thd)
+bool Signal_statement::execute(THD *thd)
 {
-  int result= 1;
+  bool result= TRUE;
   MYSQL_ERROR cond(thd->mem_root);
 
-  DBUG_ENTER("SQLCOM_signal::execute");
+  DBUG_ENTER("Signal_statement::execute");
 
   thd->stmt_da->reset_diagnostics_area();
   thd->row_count_func= 0;
@@ -468,12 +468,12 @@ int SQLCOM_signal::execute(THD *thd)
 }
 
 
-int SQLCOM_resignal::execute(THD *thd)
+bool Resignal_statement::execute(THD *thd)
 {
   MYSQL_ERROR *signaled;
-  int result= 1;
+  int result= TRUE;
 
-  DBUG_ENTER("SQLCOM_resignal::execute");
+  DBUG_ENTER("Resignal_statement::execute");
 
   thd->warning_info->m_warn_id= thd->query_id;
 

=== modified file 'sql/sql_signal.h'
--- a/sql/sql_signal.h	2009-01-16 01:27:22 +0000
+++ b/sql/sql_signal.h	2009-07-29 14:56:38 +0000
@@ -17,10 +17,10 @@
 #define SQL_SIGNAL_H
 
 /**
-  Abstract_signal represents the common properties of the SIGNAL and RESIGNAL
+  Signal_common represents the common properties of the SIGNAL and RESIGNAL
   statements.
 */
-class Abstract_signal : public SQLCOM_statement
+class Signal_common : public Sql_statement
 {
 protected:
   /**
@@ -29,15 +29,15 @@ protected:
     @param cond the condition signaled if any, or NULL.
     @param set collection of signal condition item assignments.
   */
-  Abstract_signal(LEX *lex,
-                  const sp_cond_type_t *cond,
-                  const Set_signal_information& set)
-    : SQLCOM_statement(lex),
+  Signal_common(LEX *lex,
+                const sp_cond_type_t *cond,
+                const Set_signal_information& set)
+    : Sql_statement(lex),
       m_cond(cond),
       m_set_signal_information(set)
   {}
 
-  virtual ~Abstract_signal()
+  virtual ~Signal_common()
   {}
 
   /**
@@ -73,9 +73,9 @@ protected:
     Raise a SQL condition.
     @param thd the current thread.
     @param cond the condition to raise.
-    @return 0 on success.
+    @return false on success.
   */
-  int raise_condition(THD *thd, MYSQL_ERROR *cond);
+  bool raise_condition(THD *thd, MYSQL_ERROR *cond);
 
   /**
     The condition to signal or resignal.
@@ -91,9 +91,9 @@ protected:
 };
 
 /**
-  SQLCOM_signal represents a SIGNAL statement.
+  Signal_statement represents a SIGNAL statement.
 */
-class SQLCOM_signal : public Abstract_signal
+class Signal_statement : public Signal_common
 {
 public:
   /**
@@ -102,13 +102,13 @@ public:
     @param cond the SQL condition to signal (required).
     @param set the collection of signal informations to signal.
   */
-  SQLCOM_signal(LEX *lex,
+  Signal_statement(LEX *lex,
                 const sp_cond_type_t *cond,
                 const Set_signal_information& set)
-    : Abstract_signal(lex, cond, set)
+    : Signal_common(lex, cond, set)
   {}
 
-  virtual ~SQLCOM_signal()
+  virtual ~Signal_statement()
   {}
 
   /**
@@ -116,13 +116,13 @@ public:
     @param thd the current thread.
     @return 0 on success.
   */
-  virtual int execute(THD *thd);
+  virtual bool execute(THD *thd);
 };
 
 /**
-  SQLCOM_resignal represents a RESIGNAL statement.
+  Resignal_statement represents a RESIGNAL statement.
 */
-class SQLCOM_resignal : public Abstract_signal
+class Resignal_statement : public Signal_common
 {
 public:
   /**
@@ -131,13 +131,13 @@ public:
     @param cond the SQL condition to resignal (optional, may be NULL).
     @param set the collection of signal informations to resignal.
   */
-  SQLCOM_resignal(LEX *lex,
-                  const sp_cond_type_t *cond,
-                  const Set_signal_information& set)
-    : Abstract_signal(lex, cond, set)
+  Resignal_statement(LEX *lex,
+                     const sp_cond_type_t *cond,
+                     const Set_signal_information& set)
+    : Signal_common(lex, cond, set)
   {}
 
-  virtual ~SQLCOM_resignal()
+  virtual ~Resignal_statement()
   {}
 
   /**
@@ -145,7 +145,7 @@ public:
     @param thd the current thread.
     @return 0 on success.
   */
-  virtual int execute(THD *thd);
+  virtual bool execute(THD *thd);
 };
 
 #endif

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-07-21 14:57:51 +0000
+++ b/sql/sql_yacc.yy	2009-07-29 14:56:38 +0000
@@ -2764,9 +2764,8 @@ signal_stmt:
             Yacc_state *state= & thd->m_parser_state->m_yacc;
 
             lex->sql_command= SQLCOM_SIGNAL;
-            lex->m_stmt= new (thd->mem_root) SQLCOM_signal(lex, 
-                                                           $2,
-                                                           state->m_set_signal_info);
+            lex->m_stmt= new (thd->mem_root) Signal_statement(lex, $2,
+                                                      state->m_set_signal_info);
             if (lex->m_stmt == NULL)
               MYSQL_YYABORT;
           }
@@ -2904,9 +2903,8 @@ resignal_stmt:
             Yacc_state *state= & thd->m_parser_state->m_yacc;
 
             lex->sql_command= SQLCOM_RESIGNAL;
-            lex->m_stmt= new (thd->mem_root) SQLCOM_resignal(lex, 
-                                                             $2,
-                                                             state->m_set_signal_info);
+            lex->m_stmt= new (thd->mem_root) Resignal_statement(lex, $2,
+                                                      state->m_set_signal_info);
             if (lex->m_stmt == NULL)
               MYSQL_YYABORT;
           }


Attachment: [text/bzr-bundle] bzr/roy.lyseng@sun.com-20090729145638-4fbqdioigstj6077.bundle
Thread
bzr commit into mysql-5.4 branch (roy.lyseng:2835) Roy Lyseng29 Jul
  • Re: bzr commit into mysql-5.4 branch (roy.lyseng:2835)Konstantin Osipov29 Jul