#At file:///home/malff/BZR-TREE/mysql-6.0-wl2110-review-part3/
2675 Marc Alff 2008-07-22
WL#2110 (Stored Procedures: Implement SIGNAL)
Formal review part 3/10: Handle condition
This patch adjust the code to comply with the changes in
Internal_error_handler::raise_condition().
sql/handler.cc
sql/log.cc
sql/sp.cc
sql/sql_acl.cc
sql/unireg.cc
modified:
sql/handler.cc
sql/log.cc
sql/sp.cc
sql/sql_acl.cc
sql/unireg.cc
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-07-09 07:12:43 +0000
+++ b/sql/handler.cc 2008-07-23 00:25:53 +0000
@@ -1854,23 +1854,17 @@ static const char *check_lowercase_names
struct Ha_delete_table_error_handler: public Internal_error_handler
{
public:
- virtual bool handle_error(uint sql_errno,
- const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd);
+ virtual bool handle_condition(THD *thd, const SQL_condition *cond);
char buff[MYSQL_ERRMSG_SIZE];
};
bool
Ha_delete_table_error_handler::
-handle_error(uint sql_errno,
- const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd)
+handle_condition(THD *, const SQL_condition *cond)
{
/* Grab the error message */
- strmake(buff, message, sizeof(buff)-1);
+ strmake(buff, cond->get_message_text(), sizeof(buff)-1);
return TRUE;
}
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2008-06-28 11:00:59 +0000
+++ b/sql/log.cc 2008-07-23 00:25:53 +0000
@@ -81,19 +81,14 @@ public:
virtual ~Silence_log_table_errors() {}
- virtual bool handle_error(uint sql_errno, const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd);
+ virtual bool handle_condition(THD *thd, const SQL_condition *cond);
const char *message() const { return m_message; }
};
bool
-Silence_log_table_errors::handle_error(uint /* sql_errno */,
- const char *message_arg,
- MYSQL_ERROR::enum_warning_level /* level */,
- THD * /* thd */)
+Silence_log_table_errors::handle_condition(THD *, const SQL_condition *cond)
{
- strmake(m_message, message_arg, sizeof(m_message)-1);
+ strmake(m_message, cond->get_message_text(), sizeof(m_message)-1);
return TRUE;
}
=== modified file 'sql/sp.cc'
--- a/sql/sp.cc 2008-06-04 11:18:52 +0000
+++ b/sql/sp.cc 2008-07-23 00:25:53 +0000
@@ -496,18 +496,15 @@ db_find_routine(THD *thd, int type, sp_n
struct Silence_deprecated_warning : public Internal_error_handler
{
public:
- virtual bool handle_error(uint sql_errno, const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd);
+ virtual bool handle_condition(THD *thd, const SQL_condition *cond);
};
bool
-Silence_deprecated_warning::handle_error(uint sql_errno, const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd)
+Silence_deprecated_warning::handle_condition(THD *thd,
+ const SQL_condition *cond)
{
- if (sql_errno == ER_WARN_DEPRECATED_SYNTAX &&
- level == MYSQL_ERROR::WARN_LEVEL_WARN)
+ if (cond->m_sql_errno == ER_WARN_DEPRECATED_SYNTAX &&
+ cond->m_level == MYSQL_ERROR::WARN_LEVEL_WARN)
return TRUE;
return FALSE;
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2008-06-28 11:00:59 +0000
+++ b/sql/sql_acl.cc 2008-07-23 00:25:53 +0000
@@ -6132,9 +6132,7 @@ public:
virtual ~Silence_routine_definer_errors()
{}
- virtual bool handle_error(uint sql_errno, const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd);
+ virtual bool handle_condition(THD *thd, const SQL_condition *cond);
bool has_errors() { return is_grave; }
@@ -6143,18 +6141,17 @@ private:
};
bool
-Silence_routine_definer_errors::handle_error(uint sql_errno,
- const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd)
+Silence_routine_definer_errors::handle_condition(THD *thd,
+ const SQL_condition *cond)
{
- if (level == MYSQL_ERROR::WARN_LEVEL_ERROR)
+ if (cond->m_level == MYSQL_ERROR::WARN_LEVEL_ERROR)
{
- switch (sql_errno)
+ switch (cond->m_sql_errno)
{
case ER_NONEXISTING_PROC_GRANT:
/* Convert the error into a warning. */
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, sql_errno, message);
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ cond->m_sql_errno, cond->get_message_text());
return TRUE;
default:
is_grave= TRUE;
=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc 2008-05-29 15:44:11 +0000
+++ b/sql/unireg.cc 2008-07-23 00:25:53 +0000
@@ -56,10 +56,7 @@ static bool make_empty_rec(THD *thd, int
struct Pack_header_error_handler: public Internal_error_handler
{
- virtual bool handle_error(uint sql_errno,
- const char *message,
- MYSQL_ERROR::enum_warning_level level,
- THD *thd);
+ virtual bool handle_condition(THD *thd, const SQL_condition *cond);
bool is_handled;
Pack_header_error_handler() :is_handled(FALSE) {}
};
@@ -67,12 +64,9 @@ struct Pack_header_error_handler: public
bool
Pack_header_error_handler::
-handle_error(uint sql_errno,
- const char * /* message */,
- MYSQL_ERROR::enum_warning_level /* level */,
- THD * /* thd */)
+handle_condition(THD *, const SQL_condition *cond)
{
- is_handled= (sql_errno == ER_TOO_MANY_FIELDS);
+ is_handled= (cond->m_sql_errno == ER_TOO_MANY_FIELDS);
return is_handled;
}