| 8881 | */ |
| 8882 | |
| 8883 | bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg) |
| 8884 | { |
| 8885 | SELECT_LEX *first_sl= first_select(); |
| 8886 | DBUG_ENTER("st_select_lex_unit::add_fake_select_lex"); |
| 8887 | DBUG_ASSERT(!fake_select_lex); |
| 8888 | |
| 8889 | if (!(fake_select_lex= new (thd_arg->mem_root) SELECT_LEX())) |
| 8890 | DBUG_RETURN(1); |
| 8891 | fake_select_lex->include_standalone(this, |
| 8892 | (SELECT_LEX_NODE**)&fake_select_lex); |
| 8893 | fake_select_lex->select_number= FAKE_SELECT_LEX_ID; |
| 8894 | fake_select_lex->parent_lex= thd_arg->lex; /* Used in init_query. */ |
| 8895 | fake_select_lex->make_empty_select(); |
| 8896 | fake_select_lex->set_linkage(GLOBAL_OPTIONS_TYPE); |
| 8897 | |
| 8898 | fake_select_lex->no_table_names_allowed= 1; |
| 8899 | |
| 8900 | fake_select_lex->context.outer_context=first_sl->context.outer_context; |
| 8901 | /* allow item list resolving in fake select for ORDER BY */ |
| 8902 | fake_select_lex->context.resolve_in_select_list= TRUE; |
| 8903 | fake_select_lex->context.select_lex= fake_select_lex; |
| 8904 | |
| 8905 | fake_select_lex->nest_level_base= first_select()->nest_level_base; |
| 8906 | if (fake_select_lex->set_nest_level(first_select()->nest_level)) |
| 8907 | DBUG_RETURN(1); |
| 8908 | |
| 8909 | if (!is_unit_op()) |
| 8910 | { |
| 8911 | /* |
| 8912 | This works only for |
| 8913 | (SELECT ... ORDER BY list [LIMIT n]) ORDER BY order_list [LIMIT m], |
| 8914 | (SELECT ... LIMIT n) ORDER BY order_list [LIMIT m] |
| 8915 | just before the parser starts processing order_list |
| 8916 | */ |
| 8917 | fake_select_lex->no_table_names_allowed= 1; |
| 8918 | thd_arg->lex->current_select= fake_select_lex; |
| 8919 | } |
| 8920 | //thd_arg->lex->pop_context("add fake"); |
| 8921 | DBUG_RETURN(0); |
| 8922 | } |
| 8923 | |
| 8924 | |
| 8925 | /** |
no test coverage detected