MCPcopy Create free account
hub / github.com/MariaDB/server / end_statement

Method end_statement

sql/protocol.cc:560–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558*/
559
560void Protocol::end_statement()
561{
562#ifdef WITH_WSREP
563 /*
564 Commented out: This sanity check does not hold in general.
565 Thd->LOCK_thd_data() must be unlocked before sending response
566 to client, so BF abort may sneak in here.
567 DBUG_ASSERT(!WSREP(thd) || thd->wsrep_conflict_state() == NO_CONFLICT);
568 */
569
570 /*
571 sanity check, don't send end statement while replaying
572 */
573 DBUG_ASSERT(thd->wsrep_trx().state() != wsrep::transaction::s_replaying);
574 if (WSREP(thd) && thd->wsrep_trx().state() ==
575 wsrep::transaction::s_replaying)
576 {
577 WSREP_ERROR("attempting net_end_statement while replaying");
578 return;
579 }
580#endif /* WITH_WSREP */
581
582 DBUG_ENTER("Protocol::end_statement");
583 bool error= FALSE;
584
585 /* This can set in the case of early result sent by select_send::send_eof() */
586 if (thd->get_stmt_da()->is_sent())
587 DBUG_VOID_RETURN;
588
589 switch (thd->get_stmt_da()->status()) {
590 case Diagnostics_area::DA_ERROR:
591 thd->stop_collecting_unit_results();
592 /* The query failed, send error to log and abort bootstrap. */
593 error= send_error(thd->get_stmt_da()->sql_errno(),
594 thd->get_stmt_da()->message(),
595 thd->get_stmt_da()->get_sqlstate());
596 break;
597 case Diagnostics_area::DA_EOF:
598 case Diagnostics_area::DA_EOF_BULK:
599 if (thd->need_report_unit_results()) {
600 // bulk returning result-set, like INSERT ... RETURNING
601 // result is already send, needs an EOF with MORE_RESULT_EXISTS
602 // before sending unit result-set
603 error= send_eof(thd->server_status | SERVER_MORE_RESULTS_EXISTS,
604 thd->get_stmt_da()->statement_warn_count());
605 if (thd->report_collected_unit_results() && thd->is_error())
606 error= send_error(thd->get_stmt_da()->sql_errno(),
607 thd->get_stmt_da()->message(),
608 thd->get_stmt_da()->get_sqlstate());
609 else
610 error= send_eof(thd->server_status,
611 thd->get_stmt_da()->statement_warn_count());
612 }
613 else
614 error= send_eof(thd->server_status,
615 thd->get_stmt_da()->statement_warn_count());
616 break;
617 case Diagnostics_area::DA_OK:

Callers 15

execute_SQLFunction · 0.45
run_sql_command_thdFunction · 0.45
executeMethod · 0.45
bootstrapFunction · 0.45
do_commandFunction · 0.45
sql_parse.ccFile · 0.45
mysql_parseFunction · 0.45
executeMethod · 0.45
login_connectionFunction · 0.45
execute_directMethod · 0.45

Calls 15

stateMethod · 0.80
is_sentMethod · 0.80
get_stmt_daMethod · 0.80
statusMethod · 0.80
sql_errnoMethod · 0.80
statement_warn_countMethod · 0.80
set_is_sentMethod · 0.80
messageMethod · 0.45
get_sqlstateMethod · 0.45

Tested by 1

test_noopFunction · 0.36