From 6eaa5c3a66adc7cbe152a8791b3ad560c3a936f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Jan 2004 15:15:42 +0200 Subject: assigned correct lex->current_select for derived tables (BUG#2349) moved LIMIT initialialization, because it is need only for single select derived table mysql-test/r/derived.result: test suite for BUG#2349 mysql-test/t/derived.test: test suite for BUG#2349 sql/sql_derived.cc: assigned correct lex->current_select (BUG#2349) moved LIMIT initialialization, because it is need only for single select --- sql/sql_derived.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index e8f1c5d87de..8c0fcb7f4c3 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -146,17 +146,19 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, } derived_result->set_table(table); - 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; - if (is_union) 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; + + lex->current_select= first_select; res= mysql_select(thd, &first_select->ref_pointer_array, (TABLE_LIST*) first_select->table_list.first, first_select->with_wild, @@ -169,6 +171,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, (first_select->options | thd->options | SELECT_NO_UNLOCK), derived_result, unit, first_select); + } if (!res) { -- cgit v1.2.1