| 143 | */ |
| 144 | |
| 145 | bool net_send_error(THD *thd, uint sql_errno, const char *err, |
| 146 | const char* sqlstate) |
| 147 | { |
| 148 | bool error; |
| 149 | DBUG_ENTER("net_send_error"); |
| 150 | |
| 151 | DBUG_ASSERT(sql_errno); |
| 152 | DBUG_ASSERT(err); |
| 153 | |
| 154 | DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, err)); |
| 155 | |
| 156 | if (sqlstate == NULL) |
| 157 | sqlstate= mysql_errno_to_sqlstate(sql_errno); |
| 158 | |
| 159 | /* |
| 160 | It's one case when we can push an error even though there |
| 161 | is an OK or EOF already. |
| 162 | */ |
| 163 | thd->get_stmt_da()->set_overwrite_status(true); |
| 164 | |
| 165 | /* Abort multi-result sets */ |
| 166 | thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS; |
| 167 | |
| 168 | error= net_send_error_packet(thd, sql_errno, err, sqlstate); |
| 169 | |
| 170 | thd->get_stmt_da()->set_overwrite_status(false); |
| 171 | |
| 172 | DBUG_RETURN(error); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | Return ok to the client. |
nothing calls this directly
no test coverage detected