=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2008-07-17 17:36:22 +0000
+++ b/sql/sql_class.h	2008-07-18 21:26:53 +0000
@@ -312,8 +312,17 @@
 #define FIRST_DIAG_PROPERTY 0
 #define LAST_DIAG_PROPERTY 28
 
+/**
+  This enumeration list all the condition item names of a condition in the
+  SQL condition area.
+*/
 typedef enum enum_diag_condition_item_name
 {
+  /*
+    Conditions that can be set by the user (SIGNAL/RESIGNAL),
+    and by the server implementation (THD::raise_ER_XXX).
+  */
+
   DIAG_CLASS_ORIGIN= 0,
   DIAG_SUBCLASS_ORIGIN= 1,
   DIAG_CONSTRAINT_CATALOG= 2,
@@ -327,6 +336,11 @@
   DIAG_MESSAGE_TEXT= 10,
   DIAG_MYSQL_ERRNO= 11,
 
+  /*
+    Conditions that can be set only by the server implementation
+    (THD::raise_ER_XXX).
+  */
+
   DIAG_CONDITION_IDENTIFIER= 12,
   DIAG_CONDITION_NUMBER= 13,
   DIAG_CONNECTION_NAME= 14,
@@ -352,6 +366,10 @@
 */
 extern const LEX_STRING Diag_condition_item_names[];
 
+/**
+  This enumeration list all the statement item names of a statement in the
+  SQL statement area.
+*/
 typedef enum enum_diag_statement_item_name
 {
   DIAG_NUMBER= 0,
@@ -380,22 +398,28 @@
 class Set_signal_information
 {
 public:
+  /** Constructor. */
   Set_signal_information();
+
+  /** Copy constructor. */
   Set_signal_information(const Set_signal_information& set);
 
+  /** Destructor. */
   ~Set_signal_information()
   {}
 
+  /** Clear all items. */
   void clear();
 
   /**
     For each contition item assignment, m_item[] contains the parsed tree
-    tht represents the expression assigned, if any.
+    that represents the expression assigned, if any.
     m_item[] is an array indexed by Diag_condition_item_name.
   */
   Item *m_item[LAST_DIAG_SET_PROPERTY+1];
 };
 
+
 /**
   Location of a diagnostics area.
 */
@@ -411,6 +435,7 @@
   STACKED_AREA
 };
 
+
 /**
   Diag_condition_property is a helper used to represent the parsed tree
   for the GET DIAGNOSTICS statement, in case of condition diagnostics.
@@ -418,6 +443,11 @@
 class Diag_condition_property : public Sql_alloc
 {
 public:
+  /**
+    Constructor.
+    @param target Left part of the assignment
+    @param item_name condition item name assigned to the target
+  */
   Diag_condition_property(Item *target, Diag_condition_item_name item_name)
     : m_target(target),
       m_item_name(item_name)
@@ -428,6 +458,7 @@
 
   /** Parsed tree representing the left of the assignment. */
   Item *m_target;
+
   /** Condition item name used in the right of the assignment. */
   Diag_condition_item_name m_item_name;
 };
@@ -440,6 +471,11 @@
 class Diag_statement_property : public Sql_alloc
 {
 public:
+  /**
+    Constructor.
+    @param target Left part of the assignment
+    @param item_name statement item name assigned to the target
+  */
   Diag_statement_property(Item *target, Diag_statement_item_name item_name)
     : m_target(target),
       m_item_name(item_name)
@@ -450,6 +486,7 @@
 
   /** Parsed tree representing the left of the assignment. */
   Item *m_target;
+
   /** Condition item name used in the right of the assignment. */
   Diag_statement_item_name m_item_name;
 };
@@ -458,7 +495,7 @@
 /**
   Parser temporary internal state, used during syntax analysis.
 */
-/* FIXME: can't move to sql_lex.h due to the header dependencies */
+/* FIXME: Waiting for Bug#35577 to be merged, to use Yacc_state */
 class Tmp_syn
 {
 public:
@@ -1253,7 +1290,11 @@
 class SQL_condition : public Sql_alloc
 {
 public:
-  /** Constructor. */
+  /**
+    Constructor.
+    @param mem_root The memory root to use for the condition items
+    of this condition
+  */
   SQL_condition(MEM_ROOT *mem_root);
 
   /** Destructor. */
@@ -1285,7 +1326,7 @@
 
 
   /**
-    Set this condition area.
+    Set this condition area with a fixed message text.
     @param thd the current thread.
     @param code the error number for this condition.
     @param str the message text for this condition.
@@ -1295,6 +1336,14 @@
   void set(THD *thd, uint code, const char *str,
            MYSQL_ERROR::enum_warning_level level, myf MyFlags);
 
+  /**
+    Set this condition area with formatting of the message text.
+    @param thd the current thread.
+    @param code the error number for this condition.
+    @param str the message text printf format for this condition.
+    @param level the error level for this condition.
+    @param MyFlags additional flags.
+  */
   void set_printf(THD *thd, uint code, const char *str,
                   MYSQL_ERROR::enum_warning_level level, myf MyFlags, ...);
 
@@ -1305,10 +1354,14 @@
   */
   void set_builtin_message_text(const char* str);
 
+  /**
+    Get the MESSAGE_TEXT of this condition.
+    @return the message text.
+  */
   const char* get_message_text() const;
 
   /**
-    The length in bytes of m_message_text.
+    Get the MESSAGE_OCTET_LENGTH of this condition.
     @return the length in bytes of the message text.
   */
   int get_message_octet_length() const;
@@ -1316,20 +1369,42 @@
   /** Set the SQLSTATE of this condition. */
   void set_sqlstate(const char* sqlstate);
 
-  /** Get the SQLSTATE of this condition. */
+  /**
+    Get the SQLSTATE of this condition.
+    @return the sql state.
+  */
   const char* get_sqlstate() const
   { return m_returned_sqlstate; }
 
 public:
+  /** SQL CLASS_ORIGIN condition item. */
   UTF8String64 m_class_origin;
+
+  /** SQL SUBCLASS_ORIGIN condition item. */
   UTF8String64 m_subclass_origin;
+
+  /** SQL CONSTRAINT_CATALOG condition item. */
   UTF8String64 m_constraint_catalog;
+
+  /** SQL CONSTRAINT_SCHEMA condition item. */
   UTF8String64 m_constraint_schema;
+
+  /** SQL CONSTRAINT_NAME condition item. */
   UTF8String64 m_constraint_name;
+
+  /** SQL CATALOG_NAME condition item. */
   UTF8String64 m_catalog_name;
+
+  /** SQL SCHEMA_NAME condition item. */
   UTF8String64 m_schema_name;
+
+  /** SQL TABLE_NAME condition item. */
   UTF8String64 m_table_name;
+
+  /** SQL COLUMN_NAME condition item. */
   UTF8String64 m_column_name;
+
+  /** SQL CURSOR_NAME condition item. */
   UTF8String64 m_cursor_name;
 
 private:
@@ -1337,31 +1412,69 @@
   String m_message_text;
 
 public:
+  /** MySQL extension, MYSQL_ERRNO condition item. */
   int m_sqlcode;
+
+  /** SQL CONDITION_IDENTIFIER condition item. */
   UTF8String64 m_condition_identifier;
+
+  /** SQL CONNECTION_NAME condition item. */
   UTF8String64 m_connection_name;
+
+  /** SQL PARAMETER_MODE condition item. */
   UTF8String64 m_parameter_mode;
+
+  /** SQL PARAMETER_NAME condition item. */
   UTF8String64 m_parameter_name;
+
+  /** SQL PARAMETER_ORDINAL_POSITION condition item. */
   int m_parameter_ordinal_position;
 
 private:
+  /**
+    SQL RETURNED_SQLSTATE condition item.
+    This member is always NUL terminated.
+  */
   char m_returned_sqlstate[SQLSTATE_LENGTH+1];
 
 public:
+  /** SQL ROUTINE_CATALOG condition item. */
   UTF8String64 m_routine_catalog;
+
+  /** SQL ROUTINE_NAME condition item. */
   UTF8String64 m_routine_name;
+
+  /** SQL ROUTINE_SCHEMA condition item. */
   UTF8String64 m_routine_schema;
+
+  /** SQL SERVER_NAME condition item. */
   UTF8String64 m_server_name;
+
+  /** SQL SPECIFIC_NAME condition item. */
   UTF8String64 m_specific_name;
+
+  /** SQL TRIGGER_CATALOG condition item. */
   UTF8String64 m_trigger_catalog;
+
+  /** SQL TRIGGER_NAME condition item. */
   UTF8String64 m_trigger_name;
+
+  /** SQL TRIGGER_SCHEMA condition item. */
   UTF8String64 m_trigger_schema;
 
+  /** Severity (error, warning, note) of this condition. */
   MYSQL_ERROR::enum_warning_level m_level;
+
+  /** Additional flags. */
   myf m_flags;
+
+  /** Memory root to use to hold condition item values. */
   MEM_ROOT *m_mem_root;
 
-  /* push_warning() called with a level of ERROR: waiting for bug#36777 */
+  /*
+    FIXME: push_warning() called with a level of ERROR:
+    waiting for bug#36777 to be merged to remove this.
+  */
   bool m_broken_caller;
 };
 
@@ -1411,6 +1524,7 @@
 class Diagnostics_stmt_area
 {
 public:
+  /** Constructor. */
   Diagnostics_stmt_area()
     : m_number(0),
       m_more(FALSE),
@@ -1423,15 +1537,31 @@
     bzero((char*) warn_count, sizeof(warn_count));
   }
 
+  /** Destructor. */
   ~Diagnostics_stmt_area()
   {}
 
+  /** Clear the statement area. */
   void clear();
 
+  /** 
+    Set the read only status for this statement area.
+    This is a priviledged operation, reserved for the implementation of
+    diagnostics related statements, to enforce that the statement area is
+    left untouched during execution.
+    The diagnostics statements are:
+    - SHOW WARNINGS
+    - SHOW ERRORS
+    - GET DIAGNOSTICS
+    @param read_only the read only property to set
+  */
   void set_read_only(bool read_only)
   { m_read_only= read_only; }
 
-  /** Read only status. */
+  /**
+    Read only status.
+    @return the read only property
+  */
   bool is_read_only() const
   { return m_read_only; }
 
@@ -1467,9 +1597,14 @@
     Condition area.
   */
   List	     <SQL_condition> warn_list;
+
+  /**
+    Counters for errors/warnings/notes in the condition area.
+  */
   uint	     warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
 
 private:
+  /** Read only status. */
   bool m_read_only;
 };
 
@@ -2731,6 +2866,11 @@
   */
   void pop_internal_handler();
 
+  /**
+    Raise an ER_NO_SUCH_TABLE exception condition.
+    @param db the schema name of the missing table
+    @param table the table name of the missing table
+  */
   void raise_ER_NO_SUCH_TABLE(const char* db, const char* table)
   {
     SQL_condition cond(this->mem_root);
@@ -2742,16 +2882,61 @@
     raise_condition(& cond);
   }
 
+  /**
+    Raise an exception condition, with a fixed message.
+    @param code the MYSQL_ERRNO error code of the error
+    @param str the MESSAGE_TEXT of the error
+    @param MyFlags additional flags
+  */
   void raise_error(uint code, const char *str, myf MyFlags);
+
+  /**
+    Raise an exception condition, with a formatted message.
+    @param code the MYSQL_ERRNO error code of the error
+    @param format the MESSAGE_TEXT printf format of the error
+    @param MyFlags additional flags
+  */
   void raise_error_printf(uint code, const char *format, myf MyFlags, ...);
 
-  void raise_warning(uint code, const char *msg);
+  /**
+    Raise a completion condition (warning), with a fixed message.
+    @param code the MYSQL_ERRNO error code of the warning
+    @param str the MESSAGE_TEXT of the warning
+  */
+  void raise_warning(uint code, const char *str);
+
+  /**
+    Raise a completion condition (warning), with a formatted message.
+    @param code the MYSQL_ERRNO error code of the warning
+    @param format the MESSAGE_TEXT printf format of the warning
+  */
   void raise_warning_printf(uint code, const char *format, ...);
 
-  void raise_note(uint code, const char *msg);
+  /**
+    Raise a completion condition (note), with a fixed message.
+    @param code the MYSQL_ERRNO error code of the note
+    @param str the MESSAGE_TEXT of the note
+  */
+  void raise_note(uint code, const char *str);
+
+  /**
+    Raise a completion condition (note), with a formatted message.
+    @param code the MYSQL_ERRNO error code of the note
+    @param format the MESSAGE_TEXT printf format of the note
+  */
   void raise_note_printf(uint code, const char *format, ...);
 
+  /**
+    Raise a generic SQL condition.
+    @param cond the condition to raise
+  */
   void raise_condition(const SQL_condition *cond);
+
+  /**
+    Raise a generic SQL condition, without activation any SQL condition
+    handlers.
+    @param cond the condition to raise
+  */
   void raise_condition_no_handler(const SQL_condition *cond);
 
 private:

=== modified file 'sql/sql_fixstring.cc'
--- a/sql/sql_fixstring.cc	2008-07-15 22:13:37 +0000
+++ b/sql/sql_fixstring.cc	2008-07-18 21:26:53 +0000
@@ -48,7 +48,7 @@
   {
     m_byte_length= to_copy;
     memcpy(m_ptr, str, to_copy);
-    add_null(m_ptr + to_copy);
+    add_nul(m_ptr + to_copy);
   }
 }
 
@@ -97,7 +97,7 @@
                                              & well_formed_error_pos,
                                              & cannot_convert_error_pos,
                                              & from_end_pos);
-      add_null(m_ptr + m_byte_length);
+      add_nul(m_ptr + m_byte_length);
     }
   }
   else
@@ -107,12 +107,12 @@
     {
       m_byte_length= to_copy;
       memcpy(m_ptr, str, to_copy);
-      add_null(m_ptr + to_copy);
+      add_nul(m_ptr + to_copy);
     }
   }
 }
 
-void Fixed_string::add_null(char *ptr)
+void Fixed_string::add_nul(char *ptr)
 {
   /*
     Assume that the NUL character is always encoded using 0 bytes,

=== modified file 'sql/sql_fixstring.h'
--- a/sql/sql_fixstring.h	2008-07-15 22:13:37 +0000
+++ b/sql/sql_fixstring.h	2008-07-18 21:26:53 +0000
@@ -16,15 +16,40 @@
 #ifndef SQL_FIXSTRING_H
 #define SQL_FIXSTRING_H
 
+/**
+  This structure represents the parametrized metadata used
+  in class Fixed_string.
+  The metadata consist of 'N' and 'C' in
+  VARCHAR(N) CHARACTER SET C
+  Multiple instances of Fixed_string typically share the same
+  Fixed_string_param instance.
+*/
 struct Fixed_string_param
 {
+  /**
+    Maximum length of a VARCHAR string (N), in VARCHAR(N)
+  */
   size_t m_max_char_length;
+  /**
+    Character set of a VARCHAR string (C), in VARCHAR(N) CHARACTER SET C.
+  */
   CHARSET_INFO *m_cs;
 };
 
+/**
+  This class represents a VARCHAR string or a given fixed maximum size,
+  and of a given fixed character set.
+  The size and character set are immutable.
+  Memory used to represent the string is allocated from a provided memory root.
+*/
 class Fixed_string
 {
 public:
+  /**
+    Constructor.
+    @param param Immutable size and character set parameters
+    @param mem_root Memory root to use to represent the string value
+  */
   Fixed_string(const Fixed_string_param *param, MEM_ROOT *mem_root)
     : m_param(param),
     m_mem_root(mem_root),
@@ -34,42 +59,134 @@
     m_ptr(NULL)
   {}
 
+  /** Destructor. */
   ~Fixed_string();
 
+  /**
+    Set the string value.
+    @param str the value to set, expressed in the character set of
+    Fixed_string_param
+  */
   void set(const char* str);
+
+  /**
+    Set the string value.
+    @param str the value to set, expressed in the character set of
+    Fixed_string_param
+    @param len length, in bytes, of str
+  */
   void set(const char* str, size_t len);
+
+  /**
+    Set the string value, with character set conversion if necessary.
+    @param str the value to set, expressed in any character set
+  */
   void set(const String* str);
+
+  /**
+    Set the string value, with character set conversion if necessary.
+    @param str the value to set, expressed in character set str_cs
+    @param len length, in bytes, of str
+    @param str_cs character set of str
+  */
   void set(const char* str, size_t len, const CHARSET_INFO *str_cs);
 
+  /**
+    Predicate, indicates if the string is truncated to the maximum size.
+    @return true if the string is truncated
+  */
   bool is_truncated() const
   { return m_truncated; }
 
+  /**
+    Access to the C pointer representation of the string.
+    @return a NUL terminated C string, in the character set of
+    Fixed_string_param
+  */
   const char* ptr() const
   { return m_ptr; }
 
+  /**
+    Length, in bytes, of the C string representation,
+    excluding the terminating NUL character.
+    @return The string length in bytes
+  */
   size_t length() const
   { return m_byte_length; }
 
+  /**
+    Character set of the string.
+    @return the string character set
+  */
   const CHARSET_INFO *charset() const
   { return m_param->m_cs; }
 
+  /**
+    Set the string value from another Fixed_string.
+    Note that the character set of this object and of str must be equal.
+    @param str the string to copy
+  */
   void copy(const Fixed_string *str);
 
 private:
+  /**
+    Allocate memory for the string representation.
+    @param len size in bytes to allocate
+  */
   void reserve(size_t len);
-  void add_null(char *ptr);
-
+
+  /**
+    Add a NUL character at the end of the string.
+    @param ptr location of the NUL character
+  */
+  void add_nul(char *ptr);
+
+  /**
+    Immutable string parameters.
+    The string parameters are &lt;N&gt; and &lt;C&gt;
+    in a parametrized class 'VARCHAR(&lt;N&gt;) CHARACTER SET &lt;C&gt;'
+  */
   const Fixed_string_param *m_param;
+
+  /**
+    Memory root to use to allocate the string value.
+  */
   MEM_ROOT *m_mem_root;
+
+  /**
+    Length of the C string representation, in bytes,
+    excluding the terminating NUL character.
+  */
   size_t m_byte_length;
+
+  /**
+    Size, in bytes, of the memory allocated.
+  */
   size_t m_allocated_length;
+
+  /**
+    True if the string was truncated.
+    Note that no warnings or errors are generated,
+    the string is truncated silently.
+  */
   bool m_truncated;
+
+  /**
+    C representation of the string, NUL terminated.
+  */
   char * m_ptr;
 };
 
+/**
+  This class represents a 'VARCHAR(64) CHARACTER SET UTF8' string value.
+*/
 class UTF8String64 : public Fixed_string
 {
 public:
+  /**
+    Constructor.
+    @param root The memory root to use to represent the string value.
+  */
   UTF8String64(MEM_ROOT *root)
     : Fixed_string(& params, root)
   {}
@@ -81,9 +198,16 @@
   static const Fixed_string_param params;
 };
 
+/**
+  This class represents a 'VARCHAR(128) CHARACTER SET UTF8' string value.
+*/
 class UTF8String128 : public Fixed_string
 {
 public:
+  /**
+    Constructor.
+    @param root The memory root to use to represent the string value.
+  */
   UTF8String128(MEM_ROOT *root)
     : Fixed_string(& params, root)
   {}

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-07-17 17:36:22 +0000
+++ b/sql/sql_parse.cc	2008-07-18 21:26:53 +0000
@@ -315,7 +315,7 @@
 {
   sql_command_info *ci= sql_command_infos;
 
-#define ASSIGN_CI(CODE,CMD, NAME) ci[CMD].m_name=NAME; ci[CMD].m_code=CODE
+#define ASSIGN_CI(CODE,CMD,NAME) ci[CMD].m_name=NAME; ci[CMD].m_code=CODE
 
   bzero((uchar*) &sql_command_infos, sizeof(sql_command_infos));
 

=== modified file 'sql/sql_signal.h'
--- a/sql/sql_signal.h	2008-07-18 01:21:18 +0000
+++ b/sql/sql_signal.h	2008-07-18 21:26:53 +0000
@@ -144,7 +144,8 @@
 };
 
 /*
-  Prototyping for WL#2111
+  Prototyping for WL#2111 (GET DIAGNOSTICS)
+  code to be removed for review of SIGNAL/RESIGNAL.
 */
 #define HAVE_GET_DIAGNOSTICS
 



