MySQL 8.0.31
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:
[legend]

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 ()=default
 

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 ( )
protectedvirtualdefault

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 Auto_THD, dd::cache::Open_dictionary_tables_error_handler, dd::Check_constraint_name_error_handler, dd::Foreign_key_name_error_handler, dd::Tablespace_filename_error_handler, Open_table_error_handler, Repair_mrg_table_error_handler, MDL_deadlock_and_lock_abort_error_handler, No_such_table_error_handler, Tablespace_name_error_handler, Key_length_error_handler, Info_schema_error_handler, User_level_lock_wait_error_handler, Locking_service_deadlock_error_handler, Bad_db_error_handler, Repair_mrg_table_error_handler, MDL_deadlock_handler, Fix_row_type_error_handler, Rename_table_error_handler, DD_table_access_error_handler, dd::upgrade::Syntax_error_handler, View_metadata_updater_error_handler, Acl_ignore_error_handler, Silence_routine_definer_errors, Filesort_error_handler, anonymous_namespace{sp.cc}::Silence_deprecated_warning, Foreign_key_error_handler, Audit_error_handler, dd::sdi_utils::Closure_error_handler< CONDITION_HANDLER_CLOS >, Plugin_error_handler, Dummy_error_handler, Ignore_json_syntax_handler, histograms::Histogram_error_handler, Silence_log_table_errors, Set_var_error_handler, Ha_delete_table_error_handler, anonymous_namespace{item_strfunc.cc}::Parse_error_anonymizer, SP_instr_error_handler, MDL_deadlock_discovery_repair_handler, Deprecated_trigger_syntax_handler, Show_create_error_handler, Range_optimizer_error_handler, Parser_oom_handler, View_error_handler, Functional_index_error_handler, Acl_cache_error_handler, acl_tables_setup_for_write_and_acquire_mdl_error_handler, Drop_table_error_handler, Ignore_error_handler, Strict_error_handler, and Rmdir_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: