MySQL 8.0.29
Source Code Documentation
sql_derived.cc File Reference
#include "sql/sql_derived.h"
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "mysqld_error.h"
#include "sql/auth/auth_acls.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/join_optimizer/join_optimizer.h"
#include "sql/mem_root_array.h"
#include "sql/nested_join.h"
#include "sql/opt_trace.h"
#include "sql/query_options.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.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_parse.h"
#include "sql/sql_resolver.h"
#include "sql/sql_tmp_table.h"
#include "sql/sql_union.h"
#include "sql/sql_view.h"
#include "sql/table.h"
#include "sql/table_function.h"
#include "sql/thd_raii.h"
#include "thr_lock.h"

Functions

static void swap_column_names_of_unit_and_tmp_table (const mem_root_deque< Item * > &unit_items, const Create_col_name_list &tmp_table_col_names)
 Helper function for TABLE_LIST::setup_materialized_derived() More...
 
bool copy_contexts (THD *thd, Item *orig_expr, Item *cloned_expr)
 Copy contexts of all the fields from the original expression to the cloned expression. More...
 
static Itemparse_expression (THD *thd, Item *item, Query_block *query_block, bool is_system_view)
 Given an item and a query block, this function creates a clone of the item (unresolved) by reparsing the item. More...
 
Itemresolve_expression (THD *thd, Item *item, Query_block *query_block)
 Resolves the expression given. More...
 

Function Documentation

◆ copy_contexts()

bool copy_contexts ( THD thd,
Item orig_expr,
Item cloned_expr 
)

Copy contexts of all the fields from the original expression to the cloned expression.

Parameters
thdcurrent thread
orig_exproriginal expression
cloned_exprcloned expression
Returns
true on error, false otherwise

◆ parse_expression()

static Item * parse_expression ( THD thd,
Item item,
Query_block query_block,
bool  is_system_view 
)
static

Given an item and a query block, this function creates a clone of the item (unresolved) by reparsing the item.

Parameters
thdCurrent thread.
itemItem to be reparsed to get a clone.
query_blockquery block where expression is being parsed
is_system_viewIf this expression is part of a system view
Returns
A copy of the original item (unresolved) on success else nullptr.

◆ resolve_expression()

Item * resolve_expression ( THD thd,
Item item,
Query_block query_block 
)

Resolves the expression given.

Used with parse_expression() to clone an item during condition pushdown. Presumes the expression has the correct contexts set for all the fields that are part of it.

Parameters
thdCurrent thread.
itemItem to resolve.
query_blockquery block where this item needs to be resolved.
Returns
resolved item if resolving was successful else nullptr.

◆ swap_column_names_of_unit_and_tmp_table()

static void swap_column_names_of_unit_and_tmp_table ( const mem_root_deque< Item * > &  unit_items,
const Create_col_name_list tmp_table_col_names 
)
static

Helper function for TABLE_LIST::setup_materialized_derived()