MySQL  8.0.21
Source Code Documentation
sql_resolver.h
Go to the documentation of this file.
1 #ifndef SQL_RESOLVER_INCLUDED
2 #define SQL_RESOLVER_INCLUDED
3 
4 /* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License, version 2.0,
8  as published by the Free Software Foundation.
9 
10  This program is also distributed with certain software (including
11  but not limited to OpenSSL) that is licensed under separate terms,
12  as designated in a particular file or component or in included license
13  documentation. The authors of MySQL hereby grant you an additional
14  permission to link the program and your derivative works with the
15  separately licensed software that they have included with MySQL.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License, version 2.0, for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 #include <functional>
27 
28 class Item;
29 class THD;
30 struct TABLE;
31 struct TABLE_LIST;
32 
33 struct ORDER;
34 template <typename Element_type>
36 
38 template <class T>
39 class List;
40 
41 template <class T>
42 class mem_root_deque;
43 
44 /**
45  @file sql/sql_resolver.h
46  Name resolution functions.
47 */
48 
49 void propagate_nullability(mem_root_deque<TABLE_LIST *> *tables, bool nullable);
50 
51 bool setup_order(THD *thd, Ref_item_array ref_item_array, TABLE_LIST *tables,
52  List<Item> &fields, List<Item> &all_fields, ORDER *order);
53 bool validate_gc_assignment(List<Item> *fields, List<Item> *values, TABLE *tab);
54 
55 bool find_order_in_list(THD *thd, Ref_item_array ref_item_array,
56  TABLE_LIST *tables, ORDER *order, List<Item> &fields,
57  List<Item> &all_fields, bool is_group_field,
58  bool is_window_order);
59 
60 #include "my_table_map.h"
61 bool check_right_lateral_join(TABLE_LIST *table_ref, table_map map);
62 
63 struct ReplaceResult {
64  enum {
65  // Immediately return with an error.
67 
68  // Replace the given Item with the one in “replacement”;
69  // do not traverse further.
71 
72  // Leave this item alone, but keep traversing into its children.
74  } action;
75  Item *replacement; // Only for REPLACE.
76 };
77 
78 /**
79  Walk through the conditions and functions below the given item, and allows the
80  given functor to replace it with new items. See ReplaceResult.
81 
82  @return true on error.
83  */
84 bool WalkAndReplace(
85  THD *thd, Item *item,
86  const std::function<ReplaceResult(Item *item, Item *parent,
87  unsigned argument_idx)> &get_new_item);
88 
89 #endif /* SQL_RESOLVER_INCLUDED */
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 repla...
bool find_order_in_list(THD *thd, Ref_item_array ref_item_array, TABLE_LIST *tables, ORDER *order, List< Item > &fields, List< Item > &all_fields, bool is_group_field, bool is_window_order)
Resolve an ORDER BY or GROUP BY column reference.
Definition: sql_resolver.cc:4153
Definition: table.h:279
A wrapper class which provides array bounds checking.
Definition: sql_array.h:41
A utility for having an std::deque which stores its elements on a MEM_ROOT.
Definition: mem_root_deque.h:34
Bounds_checked_array< Item * > Ref_item_array
Definition: sql_resolver.h:35
enum ReplaceResult::@121 action
Definition: table.h:1313
Definition: sql_resolver.h:73
Definition: aggregate_check.h:523
Item * replacement
Definition: sql_resolver.h:75
bool setup_order(THD *thd, Ref_item_array ref_item_array, TABLE_LIST *tables, List< Item > &fields, List< Item > &all_fields, ORDER *order)
Resolve and setup list of expressions in ORDER BY clause.
Definition: sql_resolver.cc:4348
Definition: item.h:741
bool check_right_lateral_join(TABLE_LIST *table_ref, table_map map)
Check whether the given table function or lateral derived table depends on a table which it&#39;s RIGHT J...
Definition: sql_resolver.cc:629
void propagate_nullability(mem_root_deque< TABLE_LIST *> *tables, bool nullable)
Propagate nullability into inner tables of outer join operation.
Definition: sql_resolver.cc:3906
bool validate_gc_assignment(List< Item > *fields, List< Item > *values, TABLE *tab)
validate_gc_assignment Check whether the other values except DEFAULT are assigned for generated colum...
Definition: sql_resolver.cc:4850
uint64_t table_map
Definition: my_table_map.h:30
Definition: table.h:2494
Definition: sql_resolver.h:70
Definition: sql_resolver.h:66
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:799
Definition: sql_resolver.h:63