diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2002-04-03 17:52:31 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2002-04-03 17:52:31 +0300 |
commit | 36701f1840e2132b9fd2cd84b067ff5409a0d993 (patch) | |
tree | 39f180f89485bb324789558ed512dd5de458b459 /sql/sql_union.cc | |
parent | 576530f77175e68c11d84ada52d4db5211824313 (diff) | |
download | mariadb-git-36701f1840e2132b9fd2cd84b067ff5409a0d993.tar.gz |
fix for SQL_CALC_FOUND_ROWS in UNION's
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 541b2383e8d..7294d287bb5 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -33,6 +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; TABLE_LIST result_table_list; TABLE_LIST *first_table=(TABLE_LIST *)lex->select_lex.table_list.first; TMP_TABLE_PARAM tmp_table_param; @@ -60,6 +61,7 @@ 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; if (!order || !describe) last_sl->next=0; // Remove this extra element } @@ -198,6 +200,8 @@ 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) + thd->limit_found_rows = (ulonglong)table->file->records; } } |