MySQL  8.0.15
Source Code Documentation
Internal_error_handler Class Referenceabstract

This class represents the interface for internal error handlers. More...

#include <error_handler.h>

Inheritance diagram for Internal_error_handler:
Acl_cache_error_handler Acl_ignore_error_handler Audit_error_handler Auto_THD Bad_db_error_handler dd::Foreign_key_name_error_handler dd::sdi_utils::Closure_error_handler< CONDITION_HANDLER_CLOS > dd::Tablespace_filename_error_handler dd::upgrade_57::Syntax_error_handler DD_table_access_error_handler Deprecated_trigger_syntax_handler Drop_table_error_handler Dummy_error_handler Filesort_error_handler Fix_row_type_error_handler Foreign_key_error_handler Functional_index_error_handler Ha_delete_table_error_handler Ignore_error_handler Info_schema_error_handler Key_length_error_handler Locking_service_deadlock_error_handler MDL_deadlock_and_lock_abort_error_handler MDL_deadlock_discovery_repair_handler MDL_deadlock_handler No_such_table_error_handler Open_table_error_handler Parser_oom_handler Plugin_error_handler Range_optimizer_error_handler Rename_table_error_handler Repair_mrg_table_error_handler Repair_mrg_table_error_handler Rmdir_error_handler Set_var_error_handler Show_create_error_handler Silence_deprecated_warning Silence_log_table_errors Silence_routine_definer_errors SP_instr_error_handler Strict_error_handler Tablespace_name_error_handler User_level_lock_wait_error_handler View_error_handler View_metadata_updater_error_handler

Public Member Functions

virtual bool handle_condition (THD *thd, uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level *level, const char *msg)=0
 Handle a sql condition. More...
 

Protected Member Functions

 Internal_error_handler ()
 
Internal_error_handlerprev_internal_handler () const
 
virtual ~Internal_error_handler ()
 

Private Attributes

Internal_error_handlerm_prev_internal_handler
 

Friends

class THD
 

Detailed Description

This class represents the interface for internal error handlers.

Internal error handlers are exception handlers used by the server implementation.

Constructor & Destructor Documentation

◆ Internal_error_handler()

Internal_error_handler::Internal_error_handler ( )
inlineprotected

◆ ~Internal_error_handler()

virtual Internal_error_handler::~Internal_error_handler ( )
inlineprotectedvirtual

Member Function Documentation

◆ handle_condition()

virtual bool Internal_error_handler::handle_condition ( THD thd,
uint  sql_errno,
const char *  sqlstate,
Sql_condition::enum_severity_level level,
const char *  msg 
)
pure virtual

Handle a sql condition.

This method can be implemented by a subclass to achieve any of the following:

  • mask a warning/error internally, prevent exposing it to the user,
  • mask a warning/error and throw another one instead. When this method returns true, the sql condition is considered 'handled', and will not be propagated to upper layers. It is the responsibility of the code installing an internal handler to then check for trapped conditions, and implement logic to recover from the anticipated conditions trapped during runtime.

This mechanism is similar to C++ try/throw/catch:

  • 'try' correspond to THD::push_internal_handler(),
  • 'throw' correspond to my_error(), which invokes my_message_sql(),
  • 'catch' correspond to checking how/if an internal handler was invoked, before removing it from the exception stack with THD::pop_internal_handler().
Parameters
thdthe calling thread
sql_errnothe error number for the condition raised.
sqlstatethe SQLSTATE for the condition raised.
levelthe severity level for the condition raised.
msgthe error message for the condition raised.
Returns
true if the condition is handled

Implemented in Rename_table_error_handler, Parser_oom_handler, Silence_routine_definer_errors, User_level_lock_wait_error_handler, MDL_deadlock_discovery_repair_handler, Fix_row_type_error_handler, Acl_cache_error_handler, MDL_deadlock_handler, Ha_delete_table_error_handler, Open_table_error_handler, Acl_ignore_error_handler, DD_table_access_error_handler, Filesort_error_handler, Show_create_error_handler, Bad_db_error_handler, Rmdir_error_handler, Foreign_key_error_handler, Silence_deprecated_warning, Repair_mrg_table_error_handler, Info_schema_error_handler, Key_length_error_handler, Tablespace_name_error_handler, Functional_index_error_handler, SP_instr_error_handler, Strict_error_handler, Ignore_error_handler, Silence_log_table_errors, Range_optimizer_error_handler, No_such_table_error_handler, View_error_handler, dd::upgrade_57::Syntax_error_handler, Repair_mrg_table_error_handler, MDL_deadlock_and_lock_abort_error_handler, Drop_table_error_handler, View_metadata_updater_error_handler, Set_var_error_handler, Audit_error_handler, Plugin_error_handler, dd::sdi_utils::Closure_error_handler< CONDITION_HANDLER_CLOS >, Dummy_error_handler, dd::Foreign_key_name_error_handler, dd::Tablespace_filename_error_handler, Deprecated_trigger_syntax_handler, Auto_THD, and Locking_service_deadlock_error_handler.

◆ prev_internal_handler()

Internal_error_handler* Internal_error_handler::prev_internal_handler ( ) const
inlineprotected

Friends And Related Function Documentation

◆ THD

friend class THD
friend

Member Data Documentation

◆ m_prev_internal_handler

Internal_error_handler* Internal_error_handler::m_prev_internal_handler
private

The documentation for this class was generated from the following file: