@brief Recursive subroutine to be called from find_unit_handler() (see below). Must not be called directly, only from find_unit_handler(). */
| 1295 | Must not be called directly, only from find_unit_handler(). |
| 1296 | */ |
| 1297 | static select_handler *find_unit_handler_for_lex(THD *thd, |
| 1298 | SELECT_LEX *sel_lex, |
| 1299 | SELECT_LEX_UNIT* unit) |
| 1300 | { |
| 1301 | if (!(sel_lex->join)) |
| 1302 | return nullptr; |
| 1303 | for (TABLE_LIST *tbl= sel_lex->join->tables_list; tbl; tbl= tbl->next_local) |
| 1304 | { |
| 1305 | if (!tbl->table) |
| 1306 | continue; |
| 1307 | if (tbl->derived) |
| 1308 | { |
| 1309 | /* |
| 1310 | Skip derived table for now as they will be checked |
| 1311 | in the subsequent loop |
| 1312 | */ |
| 1313 | continue; |
| 1314 | } |
| 1315 | handlerton *ht= tbl->table->file->partition_ht(); |
| 1316 | if (!ht->create_unit) |
| 1317 | continue; |
| 1318 | select_handler *sh= ht->create_unit(thd, unit); |
| 1319 | if (sh) |
| 1320 | return sh; |
| 1321 | } |
| 1322 | |
| 1323 | for (SELECT_LEX_UNIT *un= sel_lex->first_inner_unit(); un; |
| 1324 | un= un->next_unit()) |
| 1325 | { |
| 1326 | for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select()) |
| 1327 | { |
| 1328 | select_handler *uh= find_unit_handler_for_lex(thd, sl, unit); |
| 1329 | if (uh) |
| 1330 | return uh; |
| 1331 | } |
| 1332 | } |
| 1333 | return nullptr; |
| 1334 | } |
| 1335 | |
| 1336 | |
| 1337 | /** |
no test coverage detected