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

Method execute_loop

sql/sql_prepare.cc:4654–4770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4652*/
4653
4654bool
4655Prepared_statement::execute_loop(String *expanded_query,
4656 bool open_cursor,
4657 select_result *result_arg,
4658 Server_side_cursor **cursor_arg,
4659 const InstrSlice &instrs_set_placeholder,
4660 uchar *packet,
4661 uchar *packet_end)
4662{
4663 DBUG_ASSERT(result_arg);
4664 DBUG_ASSERT(cursor_arg);
4665 Reprepare_observer reprepare_observer;
4666 bool error;
4667 iterations= FALSE;
4668 bool params_are_set= false;
4669
4670 /*
4671 - In mysql_sql_stmt_execute() we hide all "external" Items
4672 e.g. those created in the "SET STATEMENT" part of the "EXECUTE" query.
4673 - In case of mysqld_stmt_execute() there should not be "external" Items.
4674 */
4675 DBUG_ASSERT(thd->free_list == NULL);
4676
4677 if (lex->needs_reprepare)
4678 {
4679 /*
4680 Something has happened on previous execution that requires us to
4681 re-prepare before we try to execute.
4682 */
4683 lex->needs_reprepare= false;
4684 goto start_with_reprepare;
4685 }
4686
4687 /* Check if we got an error when sending long data */
4688 if (unlikely(state == Query_arena::STMT_ERROR))
4689 {
4690 my_message(last_errno, last_error, MYF(0));
4691 return TRUE;
4692 }
4693
4694reexecute:
4695 if (!params_are_set && set_parameters(expanded_query,
4696 instrs_set_placeholder,
4697 packet, packet_end))
4698 return TRUE;
4699 params_are_set= true;
4700#ifdef WITH_WSREP
4701 if (thd->wsrep_delayed_BF_abort)
4702 {
4703 WSREP_DEBUG("delayed BF abort, quitting execute_loop, stmt: %d", id);
4704 return TRUE;
4705 }
4706#endif /* WITH_WSREP */
4707
4708 // Make sure that reprepare() did not create any new Items.
4709 DBUG_ASSERT(thd->free_list == NULL);
4710
4711 /*

Callers 2

mysql_sql_stmt_executeFunction · 0.80

Calls 10

my_messageFunction · 0.85
reset_stmt_paramsFunction · 0.85
is_invalidatedMethod · 0.80
can_retryMethod · 0.80
sql_errnoMethod · 0.80
get_stmt_daMethod · 0.80
executeFunction · 0.50
is_errorMethod · 0.45
clear_errorMethod · 0.45

Tested by

no test coverage detected