| 3418 | extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); |
| 3419 | |
| 3420 | void 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 | |
| 3471 | extern "C" void *my_str_malloc_mysqld(size_t size); |
no test coverage detected