| 1636 | */ |
| 1637 | |
| 1638 | TABLE_LIST *st_select_lex::nest_last_join(THD *thd) |
| 1639 | { |
| 1640 | DBUG_ENTER("nest_last_join"); |
| 1641 | |
| 1642 | TABLE_LIST *const ptr= |
| 1643 | TABLE_LIST::new_nested_join(thd->mem_root, "(nest_last_join)", |
| 1644 | embedding, join_list, this); |
| 1645 | if (ptr == NULL) |
| 1646 | DBUG_RETURN(NULL); |
| 1647 | |
| 1648 | List<TABLE_LIST> *const embedded_list= &ptr->nested_join->join_list; |
| 1649 | |
| 1650 | for (uint i=0; i < 2; i++) |
| 1651 | { |
| 1652 | TABLE_LIST *table= join_list->pop(); |
| 1653 | table->join_list= embedded_list; |
| 1654 | table->embedding= ptr; |
| 1655 | embedded_list->push_back(table); |
| 1656 | if (table->natural_join) |
| 1657 | { |
| 1658 | ptr->is_natural_join= TRUE; |
| 1659 | /* |
| 1660 | If this is a JOIN ... USING, move the list of joined fields to the |
| 1661 | table reference that describes the join. |
| 1662 | */ |
| 1663 | if (prev_join_using) |
| 1664 | ptr->join_using_fields= prev_join_using; |
| 1665 | } |
| 1666 | } |
| 1667 | join_list->push_front(ptr); |
| 1668 | |
| 1669 | DBUG_RETURN(ptr); |
| 1670 | } |
| 1671 | |
| 1672 | |
| 1673 | /** |
nothing calls this directly
no test coverage detected