| 3577 | extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); |
| 3578 | |
| 3579 | void my_message_sql(uint error, const char *str, myf MyFlags) |
| 3580 | { |
| 3581 | THD *thd= current_thd; |
| 3582 | DBUG_ENTER("my_message_sql"); |
| 3583 | DBUG_PRINT("error", ("error: %u message: '%s'", error, str)); |
| 3584 | |
| 3585 | DBUG_ASSERT(str != NULL); |
| 3586 | /* |
| 3587 | An error should have a valid error number (!= 0), so it can be caught |
| 3588 | in stored procedures by SQL exception handlers. |
| 3589 | Calling my_error() with error == 0 is a bug. |
| 3590 | Remaining known places to fix: |
| 3591 | - storage/myisam/mi_create.c, my_printf_error() |
| 3592 | TODO: |
| 3593 | DBUG_ASSERT(error != 0); |
| 3594 | */ |
| 3595 | |
| 3596 | if (error == 0) |
| 3597 | { |
| 3598 | /* At least, prevent new abuse ... */ |
| 3599 | DBUG_ASSERT(strncmp(str, "MyISAM table", 12) == 0); |
| 3600 | error= ER_UNKNOWN_ERROR; |
| 3601 | } |
| 3602 | |
| 3603 | mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_ERROR, error, str); |
| 3604 | |
| 3605 | if (thd) |
| 3606 | { |
| 3607 | if (MyFlags & ME_FATALERROR) |
| 3608 | thd->is_fatal_error= 1; |
| 3609 | (void) thd->raise_condition(error, |
| 3610 | NULL, |
| 3611 | Sql_condition::WARN_LEVEL_ERROR, |
| 3612 | str); |
| 3613 | } |
| 3614 | |
| 3615 | /* When simulating OOM, skip writing to error log to avoid mtr errors */ |
| 3616 | DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_VOID_RETURN;); |
| 3617 | |
| 3618 | if (!thd || MyFlags & ME_NOREFRESH) |
| 3619 | sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */ |
| 3620 | DBUG_VOID_RETURN; |
| 3621 | } |
| 3622 | |
| 3623 | |
| 3624 | #ifndef EMBEDDED_LIBRARY |
nothing calls this directly
no outgoing calls
no test coverage detected