MySQL 9.1.0
Source Code Documentation
dd::upgrade::Syntax_error_handler Class Reference

This class keeps a count of all the syntax errors that occurred while parsing views, routines, events or triggers. More...

#include <server.h>

Inheritance diagram for dd::upgrade::Syntax_error_handler:
[legend]

Public Member Functions

 Syntax_error_handler ()
 
 Syntax_error_handler (Upgrade_error_counter *counter)
 
bool handle_condition (THD *, uint sql_errno, const char *, Sql_condition::enum_severity_level *, const char *msg) override
 Handle a sql condition. More...
 

Static Public Member Functions

static bool has_too_many_errors ()
 
static bool has_errors ()
 
static const char * error_message ()
 

Public Attributes

Upgrade_error_counterm_global_counter
 

Static Public Attributes

static uint parse_error_count = 0
 
static bool is_parse_error = false
 
static const uint MAX_SERVER_CHECK_FAILS = 50
 
static dd::String_type reason = ""
 

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

This class keeps a count of all the syntax errors that occurred while parsing views, routines, events or triggers.

This count is used along with MAX_SERVER_CHECK_FAILS to exit upgrade.

Constructor & Destructor Documentation

◆ Syntax_error_handler() [1/2]

dd::upgrade::Syntax_error_handler::Syntax_error_handler ( )
inline

◆ Syntax_error_handler() [2/2]

dd::upgrade::Syntax_error_handler::Syntax_error_handler ( Upgrade_error_counter counter)
inline

Member Function Documentation

◆ error_message()

const char * dd::upgrade::Syntax_error_handler::error_message ( )
static

◆ handle_condition()

bool dd::upgrade::Syntax_error_handler::handle_condition ( THD thd,
uint  sql_errno,
const char *  sqlstate,
Sql_condition::enum_severity_level level,
const char *  msg 
)
overridevirtual

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.

◆ has_errors()

bool dd::upgrade::Syntax_error_handler::has_errors ( )
static

◆ has_too_many_errors()

bool dd::upgrade::Syntax_error_handler::has_too_many_errors ( )
static

Member Data Documentation

◆ is_parse_error

bool dd::upgrade::Syntax_error_handler::is_parse_error = false
static

◆ m_global_counter

Upgrade_error_counter* dd::upgrade::Syntax_error_handler::m_global_counter

◆ MAX_SERVER_CHECK_FAILS

const uint dd::upgrade::Syntax_error_handler::MAX_SERVER_CHECK_FAILS = 50
static

◆ parse_error_count

uint dd::upgrade::Syntax_error_handler::parse_error_count = 0
static

◆ reason

dd::String_type dd::upgrade::Syntax_error_handler::reason = ""
static

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