MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / end_statement

Method end_statement

sql/protocol.cc:485–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483*/
484
485void 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/**

Callers 1

sql_parser_cleanupFunction · 0.45

Calls 10

is_sentMethod · 0.80
get_stmt_daMethod · 0.80
statusMethod · 0.80
sql_errnoMethod · 0.80
statement_warn_countMethod · 0.80
affected_rowsMethod · 0.80
last_insert_idMethod · 0.80
set_is_sentMethod · 0.80
messageMethod · 0.45
get_sqlstateMethod · 0.45

Tested by

no test coverage detected