diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2020-12-19 13:59:37 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2021-04-21 14:08:58 +0300 |
commit | 13cf8f5e9afc7f64df79b41e2b004c28086371f4 (patch) | |
tree | ed6bfed9c8488ab688b57bafa42e7eaa68ae2168 /sql/sql_union.cc | |
parent | dd6ad3806856221f1af302e61ebd985905a00060 (diff) | |
download | mariadb-git-13cf8f5e9afc7f64df79b41e2b004c28086371f4.tar.gz |
cleanup: Refactor select_limit in select lex
Replace
* select_lex::offset_limit
* select_lex::select_limit
* select_lex::explicit_limit
with select_lex::Lex_select_limit
The Lex_select_limit already existed with the same elements and was used in
by the yacc parser.
This commit is in preparation for FETCH FIRST implementation, as it
simplifies a lot of the code.
Additionally, the parser is simplified by making use of the stack to
return Lex_select_limit objects.
Cleanup of init_query() too. Removes explicit_limit= 0 as it's done a bit later
in init_select() with limit_params.empty()
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index b88d78c0db3..f1b00d75de4 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1083,7 +1083,8 @@ bool st_select_lex_unit::prepare_join(THD *thd_arg, SELECT_LEX *sl, thd_arg->lex->current_select= sl; - can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit); + can_skip_order_by= is_union_select && !(sl->braces && + sl->limit_params.explicit_limit); saved_error= join->prepare(sl->table_list.first, (derived && derived->merged ? NULL : sl->where), @@ -1449,7 +1450,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, if (fake_select_lex) { if (fake_select_lex->order_list.first || - fake_select_lex->explicit_limit) + fake_select_lex->limit_params.explicit_limit) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), "global ORDER_BY/LIMIT in recursive CTE spec"); @@ -1509,7 +1510,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, if (!unit->first_select()->next_select()) { if (!unit->fake_select_lex) - { + { Query_arena *arena, backup_arena; arena= thd->activate_stmt_arena_if_needed(&backup_arena); bool rc= unit->add_fake_select_lex(thd); @@ -1520,17 +1521,13 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, } SELECT_LEX *fake= unit->fake_select_lex; fake->order_list= sl->order_list; - fake->explicit_limit= sl->explicit_limit; - fake->select_limit= sl->select_limit; - fake->offset_limit= sl->offset_limit; + fake->limit_params= sl->limit_params; sl->order_list.empty(); - sl->explicit_limit= 0; - sl->select_limit= 0; - sl->offset_limit= 0; + sl->limit_params.clear(); if (describe) fake->options|= SELECT_DESCRIBE; } - else if (!sl->explicit_limit) + else if (!sl->limit_params.explicit_limit) sl->order_list.empty(); } } |