MySQL 8.0.39
Source Code Documentation
sql_resolver.h File Reference

Name resolution functions. More...

#include <functional>

Go to the source code of this file.

Classes

struct  ReplaceResult
 

Typedefs

typedef Bounds_checked_array< Item * > Ref_item_array
 

Functions

void propagate_nullability (mem_root_deque< Table_ref * > *tables, bool nullable)
 Propagate nullability into inner tables of outer join operation. More...
 
bool setup_order (THD *thd, Ref_item_array ref_item_array, Table_ref *tables, mem_root_deque< Item * > *fields, ORDER *order)
 Resolve and setup list of expressions in ORDER BY clause. More...
 
bool validate_gc_assignment (const mem_root_deque< Item * > &fields, const mem_root_deque< Item * > &values, TABLE *tab)
 validate_gc_assignment Check whether the other values except DEFAULT are assigned for generated columns. More...
 
bool find_order_in_list (THD *thd, Ref_item_array ref_item_array, Table_ref *tables, ORDER *order, mem_root_deque< Item * > *fields, bool is_group_field, bool is_window_order)
 Resolve an ORDER BY or GROUP BY column reference. More...
 
bool WalkAndReplace (THD *thd, Item *item, const std::function< ReplaceResult(Item *item, Item *parent, unsigned argument_idx)> &get_new_item)
 Walk through the conditions and functions below the given item, and allows the given functor to replace it with new items. More...
 

Detailed Description

Name resolution functions.

Typedef Documentation

◆ Ref_item_array

Function Documentation

◆ WalkAndReplace()

bool WalkAndReplace ( THD thd,
Item item,
const std::function< ReplaceResult(Item *item, Item *parent, unsigned argument_idx)> &  get_new_item 
)

Walk through the conditions and functions below the given item, and allows the given functor to replace it with new items.

See ReplaceResult.

This function is used both during resolving for making permanent changes to the item tree, and during optimization for making non-permanent changes.

Note that this must not be used for permanent changes during optimization, as all changes done during optimization will be rolled back if a prepared statement is re-executed.

Note also that if the replaced items have different data types than the original items, it may be necessary to adjust comparators in Item_bool_func2 objects higher up in the tree by calling set_cmp_func() on them. This is not done by this function. Partly because it's generally not used for changing data types, except in some special cases (at the time of writing, only in resolving of ROLLUP columns). But also because of the note above about making permanent changes during optimization; set_cmp_func() may make permanent changes to the item, which are not rolled back at the end of execution, so it's not safe to do this unconditionally under optimization. If adjusting the comparators is necessary, the caller of WalkAndReplace() will have to invoke set_cmp_func() manually.

Returns
true on error.