MCPcopy Create free account
hub / github.com/MariaDB/server / my_message_sql

Function my_message_sql

sql/mysqld.cc:3420–3468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3418extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
3419
3420void my_message_sql(uint error, const char *str, myf MyFlags)
3421{
3422 THD *thd= MyFlags & ME_ERROR_LOG_ONLY ? NULL : current_thd;
3423 Sql_condition::enum_warning_level level;
3424 sql_print_message_func func;
3425 DBUG_ENTER("my_message_sql");
3426 DBUG_PRINT("error", ("error: %u message: '%s' Flag: %lu", error, str,
3427 MyFlags));
3428
3429 DBUG_ASSERT(str != NULL);
3430 DBUG_ASSERT(*str != '\0');
3431 DBUG_ASSERT(error != 0);
3432 DBUG_ASSERT((MyFlags & ~(ME_BELL | ME_ERROR_LOG | ME_ERROR_LOG_ONLY |
3433 ME_NOTE | ME_WARNING | ME_FATAL)) == 0);
3434
3435 DBUG_ASSERT(str[strlen(str)-1] != '\n' || strlen(str) == MYSQL_ERRMSG_SIZE-1);
3436
3437 if (MyFlags & ME_NOTE)
3438 {
3439 level= Sql_condition::WARN_LEVEL_NOTE;
3440 func= sql_print_information;
3441 }
3442 else if (MyFlags & ME_WARNING)
3443 {
3444 level= Sql_condition::WARN_LEVEL_WARN;
3445 func= sql_print_warning;
3446 }
3447 else
3448 {
3449 level= Sql_condition::WARN_LEVEL_ERROR;
3450 func= sql_print_error;
3451 }
3452
3453 if (likely(thd))
3454 {
3455 if (unlikely(MyFlags & ME_FATAL))
3456 thd->is_fatal_error= 1;
3457 (void) thd->raise_condition(error, "\0\0\0\0\0", level, str);
3458 }
3459 else
3460 mysql_audit_general(0, MYSQL_AUDIT_GENERAL_ERROR, error, str);
3461
3462 /* When simulating OOM, skip writing to error log to avoid mtr errors */
3463 DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_VOID_RETURN;);
3464
3465 if (unlikely(!thd) || thd->log_all_errors || (MyFlags & ME_ERROR_LOG))
3466 (*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
3467 DBUG_VOID_RETURN;
3468}
3469
3470
3471extern "C" void *my_str_malloc_mysqld(size_t size);

Callers 5

del_ren_tableMethod · 0.85
emit_errorsMethod · 0.85
initMethod · 0.85
load_events_from_dbMethod · 0.85
embedded_error_handlerFunction · 0.85

Calls 2

mysql_audit_generalFunction · 0.85
raise_conditionMethod · 0.45

Tested by

no test coverage detected