MySQL 8.4.0
Source Code Documentation
|
Error handler that wraps parse error messages, removes details and silences warnings. More...
Public Member Functions | |
Parse_error_anonymizer (THD *thd, Item *arg) | |
bool | handle_condition (THD *, uint, const char *, Sql_condition::enum_severity_level *level, const char *message) override |
Handle a sql condition. More... | |
~Parse_error_anonymizer () override | |
Private Attributes | |
THD * | m_thd |
Item * | m_arg |
bool | is_handling = false |
This avoids infinite recursion through my_error(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Internal_error_handler | |
Internal_error_handler () | |
Internal_error_handler * | prev_internal_handler () const |
virtual | ~Internal_error_handler ()=default |
Error handler that wraps parse error messages, removes details and silences warnings.
We don't want statement_digest() to raise warnings about deprecated syntax or semantic problems. This is likely not interesting to the caller. Therefore this handler issues a blanket silencing of all warnings.
The reason we want to anonymize parse errors is to avoid leaking information in error messages that may be unintentionally visible to users of an application. For instance an application may in error insert an expression instead of a string:
SELECT statement_digest( (SELECT * FROM( SELECT user() ) t) );
The parser would normally raise an error saying:
You have an error in your SQL syntax; /.../ near 'root@localhost'
thus leaking data from the user
table. Therefore, the errors are in this not disclosed.
|
inline |
|
inlineoverride |
|
inlineoverridevirtual |
Handle a sql condition.
This method can be implemented by a subclass to achieve any of the following:
This mechanism is similar to C++ try/throw/catch:
THD::push_internal_handler()
,my_error()
, which invokes my_message_sql()
,THD::pop_internal_handler()
.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. |
Implements Internal_error_handler.
|
private |
This avoids infinite recursion through my_error().
|
private |
|
private |