1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Remember first error in Dummy_error_handler

Use Dummy_error_handler in open_stat_tables() to ignore all errors
when opening statistics tables.
This commit is contained in:
Monty
2023-10-05 09:59:13 +03:00
parent 8941bdc474
commit fdcb443e62
3 changed files with 16 additions and 9 deletions

View File

@@ -1989,11 +1989,17 @@ private:
/**
Implements the trivial error handler which cancels all error states
and prevents an SQLSTATE to be set.
Remembers the first error
*/
class Dummy_error_handler : public Internal_error_handler
{
uint m_unhandled_errors;
uint first_error;
public:
Dummy_error_handler()
: m_unhandled_errors(0), first_error(0)
{}
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
@@ -2001,13 +2007,15 @@ public:
const char* msg,
Sql_condition ** cond_hdl)
{
/* Ignore error */
return TRUE;
m_unhandled_errors++;
if (!first_error)
first_error= sql_errno;
return TRUE; // Ignore error
}
Dummy_error_handler() = default; /* Remove gcc warning */
bool any_error() { return m_unhandled_errors != 0; }
uint got_error() { return first_error; }
};
/**
Implements the trivial error handler which counts errors as they happen.
*/