MySQL 8.4.3
Source Code Documentation
Deprecated_trigger_syntax_handler Class Reference

An error handler that catches all non-OOM errors which can occur during parsing of trigger body. More...

Inheritance diagram for Deprecated_trigger_syntax_handler:
[legend]

Public Member Functions

 Deprecated_trigger_syntax_handler ()
 
bool handle_condition (THD *thd, uint sql_errno, const char *, Sql_condition::enum_severity_level *, const char *message) override
 Handle a sql condition. More...
 
LEX_STRINGget_trigger_name ()
 
const char * get_error_message ()
 

Private Attributes

char m_message [MYSQL_ERRMSG_SIZE]
 
LEX_STRINGm_trigger_name
 

Additional Inherited Members

- Protected Member Functions inherited from Internal_error_handler
 Internal_error_handler ()
 
Internal_error_handlerprev_internal_handler () const
 
virtual ~Internal_error_handler ()=default
 

Detailed Description

An error handler that catches all non-OOM errors which can occur during parsing of trigger body.

Such errors are ignored and corresponding error message is used to construct a more verbose error message which contains name of problematic trigger. This error message is later emitted when one tries to perform DML or some of DDL on this table. Also, if possible, grabs name of the trigger being parsed so it can be used to correctly drop problematic trigger.

Constructor & Destructor Documentation

◆ Deprecated_trigger_syntax_handler()

Deprecated_trigger_syntax_handler::Deprecated_trigger_syntax_handler ( )
inline

Member Function Documentation

◆ get_error_message()

const char * Deprecated_trigger_syntax_handler::get_error_message ( )
inline

◆ get_trigger_name()

LEX_STRING * Deprecated_trigger_syntax_handler::get_trigger_name ( )
inline

◆ handle_condition()

bool Deprecated_trigger_syntax_handler::handle_condition ( THD thd,
uint  sql_errno,
const char *  sqlstate,
Sql_condition::enum_severity_level level,
const char *  msg 
)
inlineoverridevirtual

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

Implements Internal_error_handler.

Member Data Documentation

◆ m_message

char Deprecated_trigger_syntax_handler::m_message[MYSQL_ERRMSG_SIZE]
private

◆ m_trigger_name

LEX_STRING* Deprecated_trigger_syntax_handler::m_trigger_name
private

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