| 1759 | } |
| 1760 | |
| 1761 | void handle_command_error(struct st_command *command, uint error, |
| 1762 | int sys_errno) |
| 1763 | { |
| 1764 | DBUG_ENTER("handle_command_error"); |
| 1765 | DBUG_PRINT("enter", ("error: %d", error)); |
| 1766 | var_set_int("$sys_errno",sys_errno); |
| 1767 | var_set_int("$errno",error); |
| 1768 | if (error != 0) |
| 1769 | { |
| 1770 | int i; |
| 1771 | |
| 1772 | if (command->abort_on_error) |
| 1773 | { |
| 1774 | report_or_die("command \"%.*sB\" failed with error: %u my_errno: %d " |
| 1775 | "errno: %d", |
| 1776 | command->first_word_len, command->query, error, my_errno, |
| 1777 | sys_errno); |
| 1778 | DBUG_VOID_RETURN; |
| 1779 | } |
| 1780 | |
| 1781 | i= match_expected_error(command, error, NULL); |
| 1782 | |
| 1783 | if (i >= 0) |
| 1784 | { |
| 1785 | DBUG_PRINT("info", ("command \"%.*s\" failed with expected error: %u, errno: %d", |
| 1786 | command->first_word_len, command->query, error, |
| 1787 | sys_errno)); |
| 1788 | revert_properties(); |
| 1789 | DBUG_VOID_RETURN; |
| 1790 | } |
| 1791 | if (command->expected_errors.count > 0) |
| 1792 | report_or_die("command \"%.*sB\" failed with wrong error: %u " |
| 1793 | "my_errno: %d errno: %d", |
| 1794 | command->first_word_len, command->query, error, my_errno, |
| 1795 | sys_errno); |
| 1796 | } |
| 1797 | else if (command->expected_errors.err[0].type == ERR_ERRNO && |
| 1798 | command->expected_errors.err[0].code.errnum != 0) |
| 1799 | { |
| 1800 | /* Error code we wanted was != 0, i.e. not an expected success */ |
| 1801 | report_or_die("command \"%.*sB\" succeeded - should have failed with " |
| 1802 | "errno %d...", |
| 1803 | command->first_word_len, command->query, |
| 1804 | command->expected_errors.err[0].code.errnum); |
| 1805 | } |
| 1806 | revert_properties(); |
| 1807 | DBUG_VOID_RETURN; |
| 1808 | } |
| 1809 | |
| 1810 | |
| 1811 | void close_connections() |
no test coverage detected