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

Function open_and_process_table

sql/sql_base.cc:4085–4402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4083*/
4084
4085static bool
4086open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
4087 Prelocking_strategy *prelocking_strategy,
4088 bool has_prelocking_list, Open_table_context *ot_ctx)
4089{
4090 bool error= FALSE;
4091 bool safe_to_ignore_table= FALSE;
4092 LEX *lex= thd->lex;
4093 DBUG_ENTER("open_and_process_table");
4094 DEBUG_SYNC(thd, "open_and_process_table");
4095
4096 /*
4097 Ignore placeholders for derived tables. After derived tables
4098 processing, link to created temporary table will be put here.
4099 If this is derived table for view then we still want to process
4100 routines used by this view.
4101 */
4102 if (tables->derived)
4103 {
4104 if (!tables->view)
4105 {
4106 if (!tables->is_derived())
4107 tables->set_derived();
4108 goto end;
4109 }
4110 /*
4111 We restore view's name and database wiped out by derived tables
4112 processing and fall back to standard open process in order to
4113 obtain proper metadata locks and do other necessary steps like
4114 stored routine processing.
4115 */
4116 tables->db= tables->view_db;
4117 tables->table_name= tables->view_name;
4118 }
4119
4120 if (!tables->derived && is_infoschema_db(&tables->db))
4121 {
4122 /*
4123 Check whether the information schema contains a table
4124 whose name is tables->schema_table_name
4125 */
4126 ST_SCHEMA_TABLE *schema_table= tables->schema_table;
4127 if (!schema_table ||
4128 (schema_table->hidden &&
4129 ((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
4130 /*
4131 this check is used for show columns|keys from I_S hidden table
4132 */
4133 lex->sql_command == SQLCOM_SHOW_FIELDS ||
4134 lex->sql_command == SQLCOM_SHOW_KEYS)))
4135 {
4136 my_error(ER_UNKNOWN_TABLE, MYF(0),
4137 tables->table_name.str, INFORMATION_SCHEMA_NAME.str);
4138 DBUG_RETURN(1);
4139 }
4140 }
4141 /*
4142 If this TABLE_LIST object is a placeholder for an information_schema

Callers 1

open_tablesFunction · 0.85

Calls 15

is_infoschema_dbFunction · 0.85
my_errorFunction · 0.85
open_table_get_mdl_lockFunction · 0.85
mysql_schema_tableFunction · 0.85
is_temporary_tableFunction · 0.85
my_hash_freeFunction · 0.85
extend_table_listFunction · 0.85
is_derivedMethod · 0.80
push_internal_handlerMethod · 0.80
has_temporary_tablesMethod · 0.80

Tested by

no test coverage detected