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

Method reset_sub_statement_state

sql/sql_class.cc:6258–6307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6256****************************************************************************/
6257
6258void THD::reset_sub_statement_state(Sub_statement_state *backup,
6259 uint new_state)
6260{
6261#ifndef EMBEDDED_LIBRARY
6262 /* BUG#33029, if we are replicating from a buggy master, reset
6263 auto_inc_intervals_forced to prevent substatement
6264 (triggers/functions) from using erroneous INSERT_ID value
6265 */
6266 if (rpl_master_erroneous_autoinc(this))
6267 {
6268 DBUG_ASSERT(backup->auto_inc_intervals_forced.nb_elements() == 0);
6269 backup->auto_inc_intervals_forced.copy_shallow(&auto_inc_intervals_forced);
6270 MEM_UNDEFINED(&auto_inc_intervals_forced, sizeof auto_inc_intervals_forced);
6271 }
6272#endif
6273
6274 backup->option_bits= variables.option_bits;
6275 backup->count_cuted_fields= count_cuted_fields;
6276 backup->in_sub_stmt= in_sub_stmt;
6277 backup->enable_slow_log= enable_slow_log;
6278 backup->limit_found_rows= limit_found_rows;
6279 backup->cuted_fields= cuted_fields;
6280 backup->client_capabilities= client_capabilities;
6281 backup->savepoints= transaction->savepoints;
6282 backup->first_successful_insert_id_in_prev_stmt=
6283 first_successful_insert_id_in_prev_stmt;
6284 backup->first_successful_insert_id_in_cur_stmt=
6285 first_successful_insert_id_in_cur_stmt;
6286 backup->do_union= binlog_evt_union.do_union;
6287 store_slow_query_state(backup);
6288
6289 if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
6290 !is_current_stmt_binlog_format_row())
6291 {
6292 variables.option_bits&= ~OPTION_BIN_LOG;
6293 }
6294
6295 if ((backup->option_bits & OPTION_BIN_LOG) &&
6296 is_update_query(lex->sql_command) &&
6297 !is_current_stmt_binlog_format_row())
6298 mysql_bin_log.start_union_events(this, this->query_id);
6299
6300 /* Disable result sets */
6301 client_capabilities &= ~CLIENT_MULTI_RESULTS;
6302 in_sub_stmt|= new_state;
6303 cuted_fields= 0;
6304 transaction->savepoints= 0;
6305 first_successful_insert_id_in_cur_stmt= 0;
6306 reset_slow_query_state(backup);
6307}
6308
6309void THD::restore_sub_statement_state(Sub_statement_state *backup)
6310{

Callers 2

process_triggersMethod · 0.80
execute_implMethod · 0.80

Calls 6

nb_elementsMethod · 0.80
copy_shallowMethod · 0.80
requires_prelockingMethod · 0.80
start_union_eventsMethod · 0.80
is_update_queryFunction · 0.70

Tested by

no test coverage detected