MySQL 8.0.39
Source Code Documentation
|
Implements the subselect Item, used when there is a subselect in a SELECT list, WHERE, etc. More...
#include "sql/item_subselect.h"
#include <climits>
#include <cstdio>
#include <cstring>
#include <initializer_list>
#include <string>
#include <utility>
#include "decimal.h"
#include "lex_string.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_pointer_arithmetic.h"
#include "my_sys.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "scope_guard.h"
#include "sql/check_stack.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item_cmpfunc.h"
#include "sql/item_func.h"
#include "sql/item_sum.h"
#include "sql/iterators/basic_row_iterators.h"
#include "sql/iterators/composite_iterators.h"
#include "sql/iterators/ref_row_iterators.h"
#include "sql/iterators/row_iterator.h"
#include "sql/iterators/timing_iterator.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/cost_model.h"
#include "sql/join_optimizer/join_optimizer.h"
#include "sql/key.h"
#include "sql/my_decimal.h"
#include "sql/mysqld.h"
#include "sql/opt_explain_format.h"
#include "sql/opt_trace.h"
#include "sql/opt_trace_context.h"
#include "sql/parse_tree_nodes.h"
#include "sql/query_options.h"
#include "sql/query_result.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/sql_executor.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_opt_exec_shared.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_select.h"
#include "sql/sql_test.h"
#include "sql/sql_tmp_table.h"
#include "sql/sql_union.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/temp_table_param.h"
#include "sql/thd_raii.h"
#include "sql/window.h"
#include "sql_string.h"
#include "template_utils.h"
Classes | |
class | Query_result_scalar_subquery |
class | Query_result_max_min_subquery |
class | Query_result_exists_subquery |
Functions | |
Item * | remove_in2exists_conds (Item *conds) |
Removes every predicate injected by IN->EXISTS. More... | |
bool | IsItemInSubSelect (Item *item) |
Returns whether the Item is an IN-subselect. More... | |
static Item ** | find_subquery_in_select_list (Query_block *select, Item_singlerow_subselect *subquery) |
Find the scalar subquery in Query_block::fields if directly present, i.e., not inside an expression. More... | |
static bool | guaranteed_one_row (const Query_block *query_block) |
Check if a query block is guaranteed to return one row. More... | |
static bool | wrapped_in_intersect_except (Query_term *qb) |
bool | ExecuteExistsQuery (THD *thd, Query_expression *unit, RowIterator *iterator, bool *found) |
Run a query to see if it returns at least one row (stops after the first has been found, or on error). More... | |
static int | safe_index_read (TABLE *table, const Index_lookup &ref) |
Implements the subselect Item, used when there is a subselect in a SELECT list, WHERE, etc.
bool ExecuteExistsQuery | ( | THD * | thd, |
Query_expression * | unit, | ||
RowIterator * | iterator, | ||
bool * | found | ||
) |
Run a query to see if it returns at least one row (stops after the first has been found, or on error).
Unless there was an error, whether the row was found in "found".
true | on error |
|
static |
Find the scalar subquery in Query_block::fields if directly present, i.e., not inside an expression.
select | The query block owning the transformation. |
subquery | The scalar subquery to look for. |
|
static |
Check if a query block is guaranteed to return one row.
We know that this is the case if it has no tables and is not filtered with WHERE, HAVING or LIMIT clauses.
query_block | the Query_block of the query block to check |
bool IsItemInSubSelect | ( | Item * | item | ) |
Returns whether the Item is an IN-subselect.
Removes every predicate injected by IN->EXISTS.
This function is different from others:
If there are no in2exists conditions, it will return the exact same pointer. If it returns a new Item, the old Item is left alone, so it can be reused in other settings.
conds | Condition; may be nullptr. |
|
static |
|
static |