diff options
author | unknown <ramil@mysql.com> | 2005-03-02 20:04:38 +0400 |
---|---|---|
committer | unknown <ramil@mysql.com> | 2005-03-02 20:04:38 +0400 |
commit | 90eed6566b306eb048efeb9612500e4f6658b44c (patch) | |
tree | ee9f9400ac39ffe69398ac338c7121998d74613c /sql/sql_union.cc | |
parent | 91820633ac234514a617b9251cc82f50b47e16ed (diff) | |
parent | 737f7292b4cb10c1f820f932e7ff3a6fd63f44ca (diff) | |
download | mariadb-git-90eed6566b306eb048efeb9612500e4f6658b44c.tar.gz |
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 882316d57d7..5fd59500ace 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -215,8 +215,6 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, select_limit_cnt= sl->select_limit+sl->offset_limit; if (select_limit_cnt < sl->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit - if (select_limit_cnt == HA_POS_ERROR || sl->braces) - sl->options&= ~OPTION_FOUND_ROWS; can_skip_order_by= is_union && (!sl->braces || select_limit_cnt == HA_POS_ERROR); @@ -342,7 +340,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, if (arena->is_stmt_prepare()) { /* prepare fake select to initialize it correctly */ - ulong options_tmp= init_prepare_fake_select_lex(thd); + (void) init_prepare_fake_select_lex(thd); if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options, result))) { @@ -447,21 +445,14 @@ int st_select_lex_unit::exec() if (select_limit_cnt < sl->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit - /* - When using braces, SQL_CALC_FOUND_ROWS affects the whole query. - We don't calculate found_rows() per union part - */ - if (select_limit_cnt == HA_POS_ERROR || sl->braces) - sl->options&= ~OPTION_FOUND_ROWS; - else - { - /* - We are doing an union without braces. In this case - SQL_CALC_FOUND_ROWS should be done on all sub parts - */ - sl->options|= found_rows_for_union; - } - sl->join->select_options=sl->options; + /* + When using braces, SQL_CALC_FOUND_ROWS affects the whole query: + we don't calculate found_rows() per union part. + Otherwise, SQL_CALC_FOUND_ROWS should be done on all sub parts. + */ + sl->join->select_options= + (select_limit_cnt == HA_POS_ERROR || sl->braces) ? + sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union; res= sl->join->optimize(); } if (!res) @@ -493,7 +484,8 @@ int st_select_lex_unit::exec() } /* Needed for the following test and for records_at_start in next loop */ table->file->info(HA_STATUS_VARIABLE); - if (found_rows_for_union & sl->options) + if (found_rows_for_union && !sl->braces && + select_limit_cnt != HA_POS_ERROR) { /* This is a union without braces. Remember the number of rows that |