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

Method cleanup_after_query

sql/sql_class.cc:1111–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109*/
1110
1111void THD::cleanup_after_query()
1112{
1113 /*
1114 Reset rand_used so that detection of calls to rand() will save random
1115 seeds if needed by the slave.
1116
1117 Do not reset rand_used if inside a stored function or trigger because
1118 only the call to these operations is logged. Thus only the calling
1119 statement needs to detect rand() calls made by its substatements. These
1120 substatements must not set rand_used to 0 because it would remove the
1121 detection of rand() by the calling statement.
1122 */
1123 if (!in_sub_stmt) /* stored functions and triggers are a special case */
1124 {
1125 /* Forget those values, for next binlogger: */
1126 stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
1127 auto_inc_intervals_in_cur_stmt_for_binlog.empty();
1128 rand_used= 0;
1129 }
1130
1131 if (first_successful_insert_id_in_cur_stmt > 0)
1132 {
1133 /* set what LAST_INSERT_ID() will return */
1134 first_successful_insert_id_in_prev_stmt=
1135 first_successful_insert_id_in_cur_stmt;
1136 first_successful_insert_id_in_cur_stmt= 0;
1137 substitute_null_with_insert_id= TRUE;
1138 }
1139 arg_of_last_insert_id_function= 0;
1140 /* Free Items that were created during this execution */
1141 free_items();
1142 /* Reset where. */
1143 where= THD::DEFAULT_WHERE;
1144 /* reset table map for multi-table update */
1145 table_map_for_update= 0;
1146 /* reset replication info structure */
1147 if (lex && lex->mi.repl_ignore_server_ids.buffer)
1148 {
1149 delete_dynamic(&lex->mi.repl_ignore_server_ids);
1150 }
1151}
1152
1153
1154LEX_STRING *

Callers 1

sql_parser_cleanupFunction · 0.80

Calls 3

free_itemsFunction · 0.85
delete_dynamicFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected