| 1766 | */ |
| 1767 | |
| 1768 | bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg) |
| 1769 | { |
| 1770 | SELECT_LEX *first_sl= first_select(); |
| 1771 | DBUG_ENTER("add_fake_select_lex"); |
| 1772 | DBUG_ASSERT(!fake_select_lex); |
| 1773 | |
| 1774 | if (!(fake_select_lex= new (thd_arg->mem_root) SELECT_LEX())) |
| 1775 | DBUG_RETURN(1); |
| 1776 | fake_select_lex->include_standalone(this, |
| 1777 | (SELECT_LEX_NODE**)&fake_select_lex); |
| 1778 | fake_select_lex->select_number= INT_MAX; |
| 1779 | fake_select_lex->parent_lex= thd_arg->lex; /* Used in init_query. */ |
| 1780 | fake_select_lex->make_empty_select(); |
| 1781 | fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE; |
| 1782 | fake_select_lex->select_limit= 0; |
| 1783 | |
| 1784 | fake_select_lex->context.outer_context=first_sl->context.outer_context; |
| 1785 | /* allow item list resolving in fake select for ORDER BY */ |
| 1786 | fake_select_lex->context.resolve_in_select_list= TRUE; |
| 1787 | fake_select_lex->context.select_lex= fake_select_lex; |
| 1788 | |
| 1789 | if (!is_union()) |
| 1790 | { |
| 1791 | /* |
| 1792 | This works only for |
| 1793 | (SELECT ... ORDER BY list [LIMIT n]) ORDER BY order_list [LIMIT m], |
| 1794 | (SELECT ... LIMIT n) ORDER BY order_list [LIMIT m] |
| 1795 | just before the parser starts processing order_list |
| 1796 | */ |
| 1797 | global_parameters= fake_select_lex; |
| 1798 | fake_select_lex->no_table_names_allowed= 1; |
| 1799 | thd_arg->lex->current_select= fake_select_lex; |
| 1800 | } |
| 1801 | thd_arg->lex->pop_context(); |
| 1802 | DBUG_RETURN(0); |
| 1803 | } |
| 1804 | |
| 1805 | |
| 1806 | /** |
no test coverage detected