diff options
author | unknown <bell@sanja.is.com.ua> | 2004-01-14 15:15:42 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-01-14 15:15:42 +0200 |
commit | 6eaa5c3a66adc7cbe152a8791b3ad560c3a936f5 (patch) | |
tree | cc4ede0af90ea6c77c4fc0a1250ec9d038aeac72 /sql/sql_derived.cc | |
parent | 38a87d0eea0559101c683907db267d5cc1c7ef04 (diff) | |
download | mariadb-git-6eaa5c3a66adc7cbe152a8791b3ad560c3a936f5.tar.gz |
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
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 19 |
1 files changed, 11 insertions, 8 deletions
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) { |