diff options
author | Sinisa@sinisa.nasamreza.org <> | 2002-04-12 16:01:09 +0300 |
---|---|---|
committer | Sinisa@sinisa.nasamreza.org <> | 2002-04-12 16:01:09 +0300 |
commit | d61b4b6dfd5dab7f89463751e1737ae22da77a42 (patch) | |
tree | ee05026e64e491b52fed42fb6101d0bab92e2ef4 /sql/sql_union.cc | |
parent | 2f290adba7cebecedc67e44050ea0fbf49fe406f (diff) | |
download | mariadb-git-d61b4b6dfd5dab7f89463751e1737ae22da77a42.tar.gz |
Adding some things according to Monty's correct observations
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 7294d287bb5..c8237f3ae9b 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -33,7 +33,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) TABLE *table; int describe=(lex->select_lex.options & SELECT_DESCRIBE) ? 1 : 0; int res; - bool fr=false; + bool found_rows_for_union=false; TABLE_LIST result_table_list; TABLE_LIST *first_table=(TABLE_LIST *)lex->select_lex.table_list.first; TMP_TABLE_PARAM tmp_table_param; @@ -61,7 +61,10 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) */ lex_sl= sl; order= (ORDER *) lex_sl->order_list.first; - fr = lex->select_lex.options & OPTION_FOUND_ROWS && !describe && sl->select_limit && sl->select_limit != HA_POS_ERROR; + found_rows_for_union = lex->select_lex.options & OPTION_FOUND_ROWS && !describe && sl->select_limit; + if (found_rows_for_union) + lex->select_lex.options ^= OPTION_FOUND_ROWS; +// This is done to eliminate unnecessary slowing down of the first query if (!order || !describe) last_sl->next=0; // Remove this extra element } @@ -200,7 +203,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) item_list, NULL, (describe) ? 0 : order, (ORDER*) NULL, NULL, (ORDER*) NULL, thd->options, result); - if (fr && !res) + if (found_rows_for_union && !res) thd->limit_found_rows = (ulonglong)table->file->records; } } |