diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-09-26 09:49:50 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-10-13 09:40:41 +0200 |
commit | eb0804ef5e7eeb059bb193c3c6787e8a4188d34d (patch) | |
tree | 7a159b51f5ddd8d936185cb61b66a3c1c535e2d0 /sql/sql_class.cc | |
parent | 833637144178dcae60e7bb732dd373679f32d853 (diff) | |
download | mariadb-git-eb0804ef5e7eeb059bb193c3c6787e8a4188d34d.tar.gz |
MDEV-18553: MDEV-16327 pre-requisits part 1: isolation of LIMIT/OFFSET handling
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7c1d186fce1..1e969cba637 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3016,11 +3016,8 @@ int select_send::send_data(List<Item> &items) DBUG_ENTER("select_send::send_data"); /* unit is not set when using 'delete ... returning' */ - if (unit && unit->offset_limit_cnt) - { // using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(FALSE); - } + if (unit && unit->lim.check_and_move_offset()) + DBUG_RETURN(FALSE); // using limit offset,count if (thd->killed == ABORT_QUERY) DBUG_RETURN(FALSE); @@ -3285,11 +3282,8 @@ int select_export::send_data(List<Item> &items) String tmp(buff,sizeof(buff),&my_charset_bin),*res; tmp.length(0); - if (unit->offset_limit_cnt) - { // using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(0); - } + if (unit->lim.check_and_move_offset()) + DBUG_RETURN(0); // using limit offset,count if (thd->killed == ABORT_QUERY) DBUG_RETURN(0); row_count++; @@ -3545,11 +3539,8 @@ int select_dump::send_data(List<Item> &items) Item *item; DBUG_ENTER("select_dump::send_data"); - if (unit->offset_limit_cnt) - { // using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(0); - } + if (unit->lim.check_and_move_offset()) + DBUG_RETURN(0); // using limit offset,count if (thd->killed == ABORT_QUERY) DBUG_RETURN(0); @@ -3588,11 +3579,8 @@ int select_singlerow_subselect::send_data(List<Item> &items) MYF(current_thd->lex->ignore ? ME_WARNING : 0)); DBUG_RETURN(1); } - if (unit->offset_limit_cnt) - { // Using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(0); - } + if (unit->lim.check_and_move_offset()) + DBUG_RETURN(0); // Using limit offset,count if (thd->killed == ABORT_QUERY) DBUG_RETURN(0); List_iterator_fast<Item> li(items); @@ -3729,11 +3717,8 @@ int select_exists_subselect::send_data(List<Item> &items) { DBUG_ENTER("select_exists_subselect::send_data"); Item_exists_subselect *it= (Item_exists_subselect *)item; - if (unit->offset_limit_cnt) - { // Using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(0); - } + if (unit->lim.check_and_move_offset()) + DBUG_RETURN(0); // Using limit offset,count if (thd->killed == ABORT_QUERY) DBUG_RETURN(0); it->value= 1; @@ -4138,12 +4123,9 @@ int select_dumpvar::send_data(List<Item> &items) { DBUG_ENTER("select_dumpvar::send_data"); - if (unit->offset_limit_cnt) - { // using limit offset,count - unit->offset_limit_cnt--; - DBUG_RETURN(0); - } - if (row_count++) + if (unit->lim.check_and_move_offset()) + DBUG_RETURN(0); // using limit offset,count + if (row_count++) { my_message(ER_TOO_MANY_ROWS, ER_THD(thd, ER_TOO_MANY_ROWS), MYF(0)); DBUG_RETURN(1); |