From: Date: October 4 2008 1:26am Subject: bzr push into mysql-6.0-wl2110-review branch (marc.alff:2704 to 2705) List-Archive: http://lists.mysql.com/commits/55297 Message-Id: <20081003232605.DC23E2D868@lambda.WEBLAB> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2705 Marc Alff 2008-10-03 Fixed for symlink modified: sql/sql_class.cc sql/sql_signal.cc 2704 Marc Alff 2008-10-03 WL#2110 (Stored Procedures: Implement SIGNAL) WL#2265 (Stored Procedures: Implement RESIGNAL) Bug#11661 (Raising Exceptions from within stored procedures: Support for SIGNAL statement) Fixed review comments related to memory management. - Changed all the handle_condition() methods to return a SQL_condition as *output*, instead of *input*. The logic now find first where the condition should be written to, and then the caller writes the extra attributes in place. This change removes the need for SQL_condition::deep_copy(). Also, when a condition is dropped (Internal handlers, warn_list full), this saves some CPU cycle. - Removed SQL_condition::deep_copy() - Removed sp_rcontext::m_cond_root, and reverted related changes. - Adjusted the code that raises a condition according to the new paradigm. modified: sql/handler.cc sql/log.cc sql/sp.cc sql/sp_head.cc sql/sp_rcontext.cc sql/sp_rcontext.h sql/sql_acl.cc sql/sql_base.cc sql/sql_class.cc sql/sql_class.h sql/sql_fixstring.cc sql/sql_fixstring.h sql/sql_signal.cc sql/unireg.cc === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2008-10-03 21:35:16 +0000 +++ b/sql/sql_class.cc 2008-10-03 23:24:46 +0000 @@ -831,6 +831,16 @@ SQL_condition* THD::raise_condition(uint if (query_id != warn_id && !spcont) mysql_reset_errors(this, 0); + /* + TODO: replace by DBUG_ASSERT(sql_errno != 0) once all bugs similar to + Bug#36760 are fixed: a SQL condition must have a real (!=0) error number + so that it can be caught by handlers. + */ + if (sql_errno == 0) + sql_errno= ER_UNKNOWN_ERROR; + if (msg == NULL) + msg= ER(sql_errno); + if ((level == MYSQL_ERROR::WARN_LEVEL_WARN) && really_abort_on_warning()) { === modified file 'sql/sql_signal.cc' --- a/sql/sql_signal.cc 2008-10-03 21:35:16 +0000 +++ b/sql/sql_signal.cc 2008-10-03 23:24:46 +0000 @@ -308,17 +308,11 @@ void SQL_condition::set(uint sql_errno, const char* sqlstate, MYSQL_ERROR::enum_warning_level level, const char* msg) { - /* - TODO: replace by DBUG_ASSERT(code != 0) once all bugs similar to - Bug#36760 are fixed: a SQL condition must have a real (!=0) error number - so that it can be caught by handlers. - */ - if (sql_errno == 0) - sql_errno= ER_UNKNOWN_ERROR; - if (msg == NULL) - msg= ER(sql_errno); - m_sql_errno= sql_errno; + DBUG_ASSERT(sql_errno != 0); + DBUG_ASSERT(sqlstate != NULL); + DBUG_ASSERT(msg != NULL); + m_sql_errno= sql_errno; memcpy(m_returned_sqlstate, sqlstate, SQLSTATE_LENGTH); m_returned_sqlstate[SQLSTATE_LENGTH]= '\0';