| 746 | */ |
| 747 | |
| 748 | void push_warning(THD *thd, Sql_condition::enum_warning_level level, |
| 749 | uint code, const char *msg) |
| 750 | { |
| 751 | DBUG_ENTER("push_warning"); |
| 752 | DBUG_PRINT("enter", ("code: %d, msg: %s", code, msg)); |
| 753 | |
| 754 | /* |
| 755 | Calling push_warning/push_warning_printf with a level of |
| 756 | WARN_LEVEL_ERROR *is* a bug. Either use my_printf_error(), |
| 757 | my_error(), or WARN_LEVEL_WARN. |
| 758 | */ |
| 759 | DBUG_ASSERT(level != Sql_condition::WARN_LEVEL_ERROR); |
| 760 | |
| 761 | if (level == Sql_condition::WARN_LEVEL_ERROR) |
| 762 | level= Sql_condition::WARN_LEVEL_WARN; |
| 763 | |
| 764 | DBUG_ASSERT(strlen(msg)); |
| 765 | DBUG_ASSERT(msg[strlen(msg)-1] != '\n'); |
| 766 | (void) thd->raise_condition(code, "\0\0\0\0\0", level, msg); |
| 767 | |
| 768 | /* Make sure we also count warnings pushed after calling set_ok_status(). */ |
| 769 | thd->get_stmt_da()->increment_warning(); |
| 770 | |
| 771 | DBUG_VOID_RETURN; |
| 772 | } |
| 773 | |
| 774 | |
| 775 | /* |
no test coverage detected