summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_derived.cc9
-rw-r--r--sql/sql_parse.cc6
2 files changed, 4 insertions, 11 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 0e04316a2e7..f668f053442 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -154,13 +154,8 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
res= mysql_union(thd, lex, derived_result, unit);
else
{
- unit->offset_limit_cnt= first_select->offset_limit;
- unit->select_limit_cnt= first_select->select_limit+
- first_select->offset_limit;
- if (unit->select_limit_cnt < first_select->select_limit)
- unit->select_limit_cnt= HA_POS_ERROR;
- if (unit->select_limit_cnt == HA_POS_ERROR)
- first_select->options&= ~OPTION_FOUND_ROWS;
+ unit->set_limit(first_select->select_limit, first_select->offset_limit,
+ first_select);
lex->current_select= first_select;
res= mysql_select(thd, &first_select->ref_pointer_array,
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 5513aee2ff3..682699a2286 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2580,10 +2580,8 @@ mysql_execute_command(THD *thd)
select_lex->options|= SELECT_NO_UNLOCK;
select_result *result;
- unit->offset_limit_cnt= select_lex->offset_limit;
- unit->select_limit_cnt= select_lex->select_limit+select_lex->offset_limit;
- if (unit->select_limit_cnt < select_lex->select_limit)
- unit->select_limit_cnt= HA_POS_ERROR; // No limit
+ unit->set_limit(select_lex->select_limit, select_lex->offset_limit,
+ select_lex);
if (find_real_table_in_list(tables->next, tables->db, tables->real_name))
{