1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

merge with 4.0 for more memory allocation variables.

This commit is contained in:
monty@mashka.mysql.fi
2003-10-13 15:50:30 +03:00
21 changed files with 362 additions and 68 deletions

View File

@ -1574,7 +1574,8 @@ err:
Approximate how many records will be used in each table
*****************************************************************************/
static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
TABLE *table,
key_map keys,ha_rows limit)
{
int error;
@ -1583,7 +1584,7 @@ static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
{
select->head=table;
table->reginfo.impossible_range=0;
if ((error=select->test_quick_select(keys,(table_map) 0,limit))
if ((error=select->test_quick_select(thd, keys,(table_map) 0,limit))
== 1)
DBUG_RETURN(select->quick->records);
if (error == -1)
@ -1866,8 +1867,8 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
found_const_table_map,
s->on_expr ? s->on_expr : conds,
&error);
records= get_quick_record_count(select,s->table, s->const_keys,
join->row_limit);
records= get_quick_record_count(join->thd, select, s->table,
s->const_keys, join->row_limit);
s->quick=select->quick;
s->needed_reg=select->needed_reg;
select->quick=0;
@ -3377,7 +3378,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/* Join with outer join condition */
COND *orig_cond=sel->cond;
sel->cond=and_conds(sel->cond,tab->on_expr);
if (sel->test_quick_select(tab->keys,
if (sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
OPTION_FOUND_ROWS ?
@ -3390,7 +3391,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/
sel->cond=orig_cond;
if (!tab->on_expr ||
sel->test_quick_select(tab->keys,
sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
OPTION_FOUND_ROWS ?
@ -5828,7 +5829,8 @@ test_if_quick_select(JOIN_TAB *tab)
{
delete tab->select->quick;
tab->select->quick=0;
return tab->select->test_quick_select(tab->keys,(table_map) 0,HA_POS_ERROR);
return tab->select->test_quick_select(tab->join->thd, tab->keys,
(table_map) 0, HA_POS_ERROR);
}
@ -6921,7 +6923,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
For impossible ranges (like when doing a lookup on NULL on a NOT NULL
field, quick will contain an empty record set.
*/
if (!(select->quick=get_ft_or_quick_select_for_ref(table, tab)))
if (!(select->quick=get_ft_or_quick_select_for_ref(tab->join->thd,
table, tab)))
goto err;
}
}