mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
weave merge of mysql-5.5->mysql-5.5-security
This commit is contained in:
@ -991,7 +991,7 @@ JOIN::optimize()
|
||||
If all items were resolved by opt_sum_query, there is no need to
|
||||
open any tables.
|
||||
*/
|
||||
if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
|
||||
if ((res=opt_sum_query(thd, select_lex->leaf_tables, all_fields, conds)))
|
||||
{
|
||||
if (res == HA_ERR_KEY_NOT_FOUND)
|
||||
{
|
||||
@ -1972,7 +1972,11 @@ JOIN::exec()
|
||||
if (!curr_join->sort_and_group &&
|
||||
curr_join->const_tables != curr_join->tables)
|
||||
curr_join->join_tab[curr_join->const_tables].sorted= 0;
|
||||
if ((tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0)))
|
||||
|
||||
Procedure *save_proc= curr_join->procedure;
|
||||
tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0);
|
||||
curr_join->procedure= save_proc;
|
||||
if (tmp_error)
|
||||
{
|
||||
error= tmp_error;
|
||||
DBUG_VOID_RETURN;
|
||||
@ -2259,7 +2263,7 @@ JOIN::exec()
|
||||
|
||||
Item* sort_table_cond= make_cond_for_table(curr_join->tmp_having,
|
||||
used_tables,
|
||||
used_tables);
|
||||
(table_map) 0);
|
||||
if (sort_table_cond)
|
||||
{
|
||||
if (!curr_table->select)
|
||||
@ -12620,10 +12624,14 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
}
|
||||
if (join->having && join->having->val_int() == 0)
|
||||
DBUG_RETURN(NESTED_LOOP_OK); // Didn't match having
|
||||
error=0;
|
||||
if (join->procedure)
|
||||
error=join->procedure->send_row(join->procedure_fields_list);
|
||||
else if (join->do_send_rows)
|
||||
{
|
||||
if (join->procedure->send_row(join->procedure_fields_list))
|
||||
DBUG_RETURN(NESTED_LOOP_ERROR);
|
||||
DBUG_RETURN(NESTED_LOOP_OK);
|
||||
}
|
||||
error=0;
|
||||
if (join->do_send_rows)
|
||||
error=join->result->send_data(*join->fields);
|
||||
if (error)
|
||||
DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
|
||||
@ -13094,6 +13102,42 @@ static bool test_if_ref(Item_field *left_item,Item *right_item)
|
||||
return 0; // keep test
|
||||
}
|
||||
|
||||
/**
|
||||
Extract a condition that can be checked after reading given table
|
||||
|
||||
@param cond Condition to analyze
|
||||
@param tables Tables for which "current field values" are available
|
||||
@param used_table Table that we're extracting the condition for (may
|
||||
also include PSEUDO_TABLE_BITS, and may be zero)
|
||||
@param exclude_expensive_cond Do not push expensive conditions
|
||||
|
||||
@retval <>NULL Generated condition
|
||||
@retval =NULL Already checked, OR error
|
||||
|
||||
@details
|
||||
Extract the condition that can be checked after reading the table
|
||||
specified in 'used_table', given that current-field values for tables
|
||||
specified in 'tables' bitmap are available.
|
||||
If 'used_table' is 0
|
||||
- extract conditions for all tables in 'tables'.
|
||||
- extract conditions are unrelated to any tables
|
||||
in the same query block/level(i.e. conditions
|
||||
which have used_tables == 0).
|
||||
|
||||
The function assumes that
|
||||
- Constant parts of the condition has already been checked.
|
||||
- Condition that could be checked for tables in 'tables' has already
|
||||
been checked.
|
||||
|
||||
The function takes into account that some parts of the condition are
|
||||
guaranteed to be true by employed 'ref' access methods (the code that
|
||||
does this is located at the end, search down for "EQ_FUNC").
|
||||
|
||||
@note
|
||||
Make sure to keep the implementations of make_cond_for_table() and
|
||||
make_cond_after_sjm() synchronized.
|
||||
make_cond_for_info_schema() uses similar algorithm as well.
|
||||
*/
|
||||
|
||||
static COND *
|
||||
make_cond_for_table(COND *cond, table_map tables, table_map used_table)
|
||||
|
Reference in New Issue
Block a user