This class represents the interface for internal error handlers.
Internal error handlers are exception handlers used by the server implementation.
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
-
thd | the calling thread |
sql_errno | the error number for the condition raised. |
sqlstate | the SQLSTATE for the condition raised. |
level | the severity level for the condition raised. |
msg | the 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, anonymous_namespace{sql_audit.cc}::Event_tracking_error_handler, dd::sdi_utils::Closure_error_handler< CONDITION_HANDLER_CLOS >, Plugin_error_handler, Dummy_error_handler, Ignore_json_syntax_handler, Silence_log_table_errors, Set_var_error_handler, Ha_delete_table_error_handler, histograms::Background_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.