| 483 | */ |
| 484 | |
| 485 | void Protocol::end_statement() |
| 486 | { |
| 487 | DBUG_ENTER("Protocol::end_statement"); |
| 488 | DBUG_ASSERT(! thd->get_stmt_da()->is_sent()); |
| 489 | bool error= FALSE; |
| 490 | |
| 491 | /* Can not be true, but do not take chances in production. */ |
| 492 | if (thd->get_stmt_da()->is_sent()) |
| 493 | DBUG_VOID_RETURN; |
| 494 | |
| 495 | switch (thd->get_stmt_da()->status()) { |
| 496 | case Diagnostics_area::DA_ERROR: |
| 497 | /* The query failed, send error to log and abort bootstrap. */ |
| 498 | error= send_error(thd->get_stmt_da()->sql_errno(), |
| 499 | thd->get_stmt_da()->message(), |
| 500 | thd->get_stmt_da()->get_sqlstate()); |
| 501 | break; |
| 502 | case Diagnostics_area::DA_EOF: |
| 503 | error= send_eof(thd->server_status, |
| 504 | thd->get_stmt_da()->statement_warn_count()); |
| 505 | break; |
| 506 | case Diagnostics_area::DA_OK: |
| 507 | error= send_ok(thd->server_status, |
| 508 | thd->get_stmt_da()->statement_warn_count(), |
| 509 | thd->get_stmt_da()->affected_rows(), |
| 510 | thd->get_stmt_da()->last_insert_id(), |
| 511 | thd->get_stmt_da()->message()); |
| 512 | break; |
| 513 | case Diagnostics_area::DA_DISABLED: |
| 514 | break; |
| 515 | case Diagnostics_area::DA_EMPTY: |
| 516 | default: |
| 517 | DBUG_ASSERT(0); |
| 518 | error= send_ok(thd->server_status, 0, 0, 0, NULL); |
| 519 | break; |
| 520 | } |
| 521 | if (!error) |
| 522 | thd->get_stmt_da()->set_is_sent(true); |
| 523 | DBUG_VOID_RETURN; |
| 524 | } |
| 525 | |
| 526 | |
| 527 | /** |
no test coverage detected