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

Function extend_table_list

sql/sql_base.cc:4027–4058  ·  view source on GitHub ↗

If we are not already in prelocked mode and extended table list is not yet built we might have to build the prelocking set for this statement. Since currently no prelocking strategy prescribes doing anything for tables which are only read, we do below checks only if table is going to be changed. */

Source from the content-addressed store, hash-verified

4025 to be changed.
4026*/
4027bool extend_table_list(THD *thd, TABLE_LIST *tables,
4028 Prelocking_strategy *prelocking_strategy,
4029 bool has_prelocking_list)
4030{
4031 bool error= false;
4032 LEX *lex= thd->lex;
4033 bool maybe_need_prelocking=
4034 (tables->updating && tables->lock_type >= TL_FIRST_WRITE)
4035 || thd->lex->default_used;
4036
4037 if (thd->locked_tables_mode <= LTM_LOCK_TABLES &&
4038 ! has_prelocking_list && maybe_need_prelocking)
4039 {
4040 bool need_prelocking= FALSE;
4041 TABLE_LIST **save_query_tables_last= lex->query_tables_last;
4042 /*
4043 Extend statement's table list and the prelocking set with
4044 tables and routines according to the current prelocking
4045 strategy.
4046
4047 For example, for DML statements we need to add tables and routines
4048 used by triggers which are going to be invoked for this element of
4049 table list and also add tables required for handling of foreign keys.
4050 */
4051 error= prelocking_strategy->handle_table(thd, lex, tables,
4052 &need_prelocking);
4053
4054 if (need_prelocking && ! lex->requires_prelocking())
4055 lex->mark_as_requiring_prelocking(save_query_tables_last);
4056 }
4057 return error;
4058}
4059
4060
4061/**

Callers 2

handle_endMethod · 0.85
open_and_process_tableFunction · 0.85

Calls 3

requires_prelockingMethod · 0.80
handle_tableMethod · 0.45

Tested by

no test coverage detected