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

Function find_select_handler_inner

sql/sql_select.cc:5235–5272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5233*/
5234
5235static
5236select_handler *find_select_handler_inner(THD *thd,
5237 SELECT_LEX *select_lex,
5238 SELECT_LEX_UNIT *select_lex_unit)
5239{
5240 // Pushdown is not supported for non-top-level SELECTs
5241 if (select_lex->master_unit()->outer_select())
5242 return 0;
5243
5244 TABLE_LIST *tbl= nullptr;
5245 // For SQLCOM_INSERT_SELECT the server takes TABLE_LIST
5246 // from thd->lex->query_tables and skips its first table
5247 // b/c it is the target table for the INSERT..SELECT.
5248 if (thd->lex->sql_command != SQLCOM_INSERT_SELECT)
5249 {
5250 tbl= select_lex->join->tables_list;
5251 }
5252 else if (thd->lex->query_tables &&
5253 thd->lex->query_tables->next_global)
5254 {
5255 tbl= thd->lex->query_tables->next_global;
5256 }
5257 else
5258 return 0;
5259
5260 for (;tbl; tbl= tbl->next_global)
5261 {
5262 if (!tbl->table)
5263 continue;
5264 handlerton *ht= tbl->table->file->partition_ht();
5265 if (!ht->create_select)
5266 continue;
5267 select_handler *sh= ht->create_select(thd, select_lex, select_lex_unit);
5268 if (sh)
5269 return sh;
5270 }
5271 return 0;
5272}
5273
5274
5275/**

Callers 2

Calls 4

master_unitMethod · 0.80
create_selectMethod · 0.80
outer_selectMethod · 0.45
partition_htMethod · 0.45

Tested by

no test coverage detected