1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

fix for SQL_CALC_FOUND_ROWS in UNION's

This commit is contained in:
unknown
2002-04-03 17:52:31 +03:00
parent 576530f771
commit 36701f1840
4 changed files with 17 additions and 1 deletions

View File

@@ -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;
}
}