MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
parse_tree_node_base.h
Go to the documentation of this file.
1/* Copyright (c) 2013, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef PARSE_TREE_NODE_BASE_INCLUDED
25#define PARSE_TREE_NODE_BASE_INCLUDED
26
27#include <assert.h>
28#include <cstdarg>
29#include <cstdlib>
30#include <new>
31#include <queue>
32#include <typeinfo>
33
34#include "memory_debugging.h"
35#include "my_alloc.h"
36#include "my_compiler.h"
37
38#include "mem_root_deque.h"
39#include "my_inttypes.h" // TODO: replace with cstdint
40#include "sql-common/json_dom.h"
41#include "sql/check_stack.h"
42#include "sql/parse_location.h"
43#include "sql/sql_const.h"
44#include "sql/sql_list.h"
45
46class Query_block;
47class THD;
48
49// uncachable cause
50#define UNCACHEABLE_DEPENDENT 1
51#define UNCACHEABLE_RAND 2
52#define UNCACHEABLE_SIDEEFFECT 4
53/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
54#define UNCACHEABLE_UNITED 8
55#define UNCACHEABLE_CHECKOPTION 16
56
57/**
58 Names for different query parse tree parts
59*/
60
62 CTX_NONE = 0, ///< Empty value
63 CTX_MESSAGE, ///< "No tables used" messages etc.
64 CTX_TABLE, ///< for single-table UPDATE/DELETE/INSERT/REPLACE
65 CTX_SELECT_LIST, ///< SELECT (subquery), (subquery)...
66 CTX_UPDATE_VALUE, ///< UPDATE ... SET field=(subquery)...
67 CTX_INSERT_VALUES, ///< INSERT ... VALUES
68 CTX_INSERT_UPDATE, ///< INSERT ... ON DUPLICATE KEY UPDATE ...
73 CTX_DERIVED, ///< "Derived" subquery
74 CTX_WHERE, ///< Inside WHERE condition
75 CTX_ON, ///< Inside ON condition
76 CTX_WINDOW, ///< Named or unnamed window
77 CTX_HAVING, ///< Inside HAVING condition
78 CTX_QUALIFY, ///< Inside QUALIFY condition
79 CTX_ORDER_BY, ///< ORDER BY clause execution context
80 CTX_GROUP_BY, ///< GROUP BY clause execution context
81 CTX_SIMPLE_ORDER_BY, ///< ORDER BY clause execution context
82 CTX_SIMPLE_GROUP_BY, ///< GROUP BY clause execution context
83 CTX_DISTINCT, ///< DISTINCT clause execution context
84 CTX_SIMPLE_DISTINCT, ///< DISTINCT clause execution context
85 CTX_BUFFER_RESULT, ///< see SQL_BUFFER_RESULT in the manual
86 CTX_ORDER_BY_SQ, ///< Subquery in ORDER BY clause item tree
87 CTX_GROUP_BY_SQ, ///< Subquery in GROUP BY clause item tree
88 CTX_OPTIMIZED_AWAY_SUBQUERY, ///< Subquery executed once during optimization
90 CTX_UNION_RESULT, ///< Pseudo-table context for UNION result
92 CTX_INTERSECT_RESULT, ///< Pseudo-table context
94 CTX_EXCEPT_RESULT, ///< Pseudo-table context
96 CTX_UNARY_RESULT, ///< Pseudo-table context
97 CTX_QUERY_SPEC ///< Inner SELECTs of UNION expression
98};
99
100class Query_term;
114
118 bool m_has_order{false};
119 QueryLevel(MEM_ROOT *mem_root, Surrounding_context sc, bool has_order = false)
120 : m_type(sc), m_elts(mem_root), m_has_order(has_order) {}
121};
122
123class Json_object;
124class Parse_tree_root;
125
126/**
127 Holds the json parse tree being generated by the SHOW PARSE_TREE command.
128
129 The json tree gets built with the help of the two parse tree node walkers
130 namely contextualize() and itemize(). Each contextualize() (or itemize())
131 creates a new json subtree. In the beginning of contextualize(),
132 push_level() is called, where a new Json object is created and pushed to
133 m_json_obj_stack. This object now becomes a parent json object to which all
134 the subtrees created by the inner contextualize() calls will be added as
135 its children. Each contextualize() will end with a call to pop_level() where
136 the current parent will be popped out and made the child of the now-current
137 parent object in the stack. This way the json tree is built identical to the
138 tree of Parse_tree_node's.
139*/
141 private:
142 std::vector<Json_object *> m_json_obj_stack{};
145
146 // Reference position for calculating relative positions of objects in the
147 // grammar.
148 const char *m_reference_pos = nullptr;
149
150 // Comparator to sort Json_array using 'startpos' field. The children needs
151 // to be sorted in the order they occur in the syntax, in order to help
152 // generate the original SQL back from the json tree. The order of the
153 // contextualize() calls is not guaranteed to be in the syntax order of the
154 // objects whose contextualize() functions are called. Hence, the sorting.
156 bool operator()(const Json_dom_ptr &a, const Json_dom_ptr &b) const {
157 const Json_object *obj_a = down_cast<const Json_object *>(a.get());
158 const Json_object *obj_b = down_cast<const Json_object *>(b.get());
159
160 longlong inta = down_cast<Json_int *>(obj_a->get("startpos"))->value();
161 longlong intb = down_cast<Json_int *>(obj_b->get("startpos"))->value();
162 return inta < intb;
163 }
164 };
165 static constexpr Parse_tree_comparator m_comparator = {};
166
167 /**
168 Make the obj a child of the current parent object in the object stack.
169
170 @param obj Input json object resembling a parse tree node.
171
172 @retval false: success; true: error
173 */
174 bool make_child(Json_object *obj);
175
176 /**
177 Pop the current object in the object stack, and return it.
178 */
180
181 public:
182 explicit Show_parse_tree(Show_parse_tree *parent_tree = nullptr)
183 : m_parent_show_parse_tree(parent_tree) {}
184
185 /**
186 Create a json node out of the parse tree node position and type name, and
187 push it onto the json object stack. Effectively, a new json stack level is
188 created, to which json children would be added.
189
190 @param pos syntax position of the parse tree node
191 @param typname type name of the class of the parse tree node
192
193 @retval false success
194 @retval true error
195 */
196 bool push_level(const POS &pos, const char *typname);
197
198 /**
199 Get the current object under which new json objects are to be added as
200 children. Effectively, this is the outermost object in the object stack.
201
202 retval nullptr if the object stack is empty.
203 */
205 return m_json_obj_stack.empty()
206 ? nullptr
207 : static_cast<Json_object *>(m_json_obj_stack.back());
208 }
209
210 /**
211 Generate the json tree text from the json tree, and return it.
212
213 @retval non-empty success
214 @retval empty error
215 */
216 std::string get_parse_tree();
217
218 /**
219 Pop out the json node pushed by push_level() and make it a child of the
220 inner json object in the stack.
221
222 @retval false: success; true: error
223 */
225};
226
227/**
228 Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
229*/
230template <typename Context>
232 friend class Item; // for direct access to the "contextualized" field
233 friend class Item_subselect;
234
236 void operator=(const Parse_tree_node_tmpl &); // undefined
237
238#ifndef NDEBUG
239 private:
240 bool contextualized = false; // true if the node object is contextualized
241#endif // NDEBUG
242
243 public:
244 typedef Context context_t;
245 POS m_pos; // Grammar position. is_empty() if node not created in parser.
246
247 static void *operator new(size_t size, MEM_ROOT *mem_root,
248 const std::nothrow_t &arg
249 [[maybe_unused]] = std::nothrow) noexcept {
250 return mem_root->Alloc(size);
251 }
252 static void operator delete(void *ptr [[maybe_unused]],
253 size_t size [[maybe_unused]]) {
254 TRASH(ptr, size);
255 }
256 static void operator delete(void *, MEM_ROOT *,
257 const std::nothrow_t &) noexcept {}
258
259 protected:
261
262 explicit Parse_tree_node_tmpl(const POS &pos) : m_pos(pos) {}
263
264 explicit Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos) {
265 // Range of this item list should be from first character position of
266 // start_pos to the last character position of end_pos.
267 m_pos.cpp.start = start_pos.cpp.start;
268 m_pos.cpp.end = end_pos.cpp.end;
269 m_pos.raw.start = start_pos.raw.start;
270 m_pos.raw.end = end_pos.raw.end;
271 }
272
275
276 /**
277 Do all context-sensitive things and mark the node as contextualized
278
279 @param pc current parse context
280
281 @retval false success
282 @retval true syntax/OOM/etc error
283 */
284 virtual bool do_contextualize(Context *pc) {
285 uchar dummy;
286 if (check_stack_overrun(pc->thd, STACK_MIN_SIZE, &dummy)) return true;
287
288#ifndef NDEBUG
289 assert(!contextualized);
290 contextualized = true;
291#endif // NDEBUG
292
293 return false;
294 }
295
296 /**
297 Add all the node-specific json fields. Any class that needs to add such
298 info should override this function rather than doing it in
299 do_contextualize(). E.g. the parse tree node for AVG() may have "distinct"
300 field to indicate if AVG(DISTINCT ...) is used or not.
301
302 @param json_obj Json object for this parse tree node.
303 */
304 virtual void add_json_info(Json_object *json_obj [[maybe_unused]]) {}
305
306 public:
307 virtual ~Parse_tree_node_tmpl() = default;
308
309#ifndef NDEBUG
310 bool is_contextualized() const { return contextualized; }
311#endif // NDEBUG
312
313 // Derived classes should not override this. If needed, they should override
314 // do_contextualize().
315 // Visual Studio with MSVC_CPPCHECK=ON gives warning C26435:
316 // Function <fun> should specify exactly one of
317 // 'virtual', 'override', or 'final'
320 virtual bool contextualize(Context *pc) final {
321 // For condition#2 below ... If position is empty, this item was not
322 // created in the parser; so don't show it in the parse tree.
323 if (pc->m_show_parse_tree == nullptr || this->m_pos.is_empty())
324 return do_contextualize(pc);
325
326 Show_parse_tree *tree = pc->m_show_parse_tree.get();
327
328 if (begin_parse_tree(tree)) return true;
329
330 if (do_contextualize(pc)) return true;
331
332 if (end_parse_tree(tree)) return true;
333
334 return false;
335 }
337
338 /**
339 syntax_error() function replacement for deferred reporting of syntax
340 errors
341
342 @param pc Current parse context.
343 @param pos Location of the error in lexical scanner buffers.
344 */
345 void error(Context *pc, const POS &pos) const {
346 pc->thd->syntax_error_at(pos);
347 }
348
349 /**
350 syntax_error() function replacement for deferred reporting of syntax
351 errors
352
353 @param pc Current parse context.
354 @param pos Location of the error in lexical scanner buffers.
355 @param msg Error message.
356 */
357 void error(Context *pc, const POS &pos, const char *msg) const {
358 pc->thd->syntax_error_at(pos, "%s", msg);
359 }
360
361 /**
362 syntax_error() function replacement for deferred reporting of syntax
363 errors
364
365 @param pc Current parse context.
366 @param pos Location of the error in lexical scanner buffers.
367 @param format Error message format string with optional argument list.
368 */
369 void errorf(Context *pc, const POS &pos, const char *format, ...) const
370 MY_ATTRIBUTE((format(printf, 4, 5)));
371};
372
373template <typename Context>
374inline void Parse_tree_node_tmpl<Context>::errorf(Context *pc, const POS &pos,
375 const char *format,
376 ...) const {
377 va_list args;
378 va_start(args, format);
379 pc->thd->vsyntax_error_at(pos, format, args);
380 va_end(args);
381}
382
383template <typename Context>
385 if (tree == nullptr) return false;
386 if (tree->push_level(this->m_pos, typeid(*this).name())) return true;
387
388 // Add node-specific fields. Do it here rather than in end_parse_tree() : We
389 // want to show field values *before* they get changed in contextualization.
390 // E.g. join type can change from left to right join.
391 Json_object *json_obj = tree->get_current_parent();
392 assert(json_obj != nullptr);
393 add_json_info(json_obj);
394
395 return false;
396}
397
398template <typename Context>
400 if (tree == nullptr) return false;
401 return tree->pop_level();
402}
403
405 std::unique_ptr<Show_parse_tree> m_show_parse_tree = nullptr;
406
408 bool show_parse_tree = false,
409 Show_parse_tree *parent_show_parent_tree = nullptr) {
410 if (show_parse_tree) {
411 m_show_parse_tree = std::unique_ptr<Show_parse_tree>(
412 new (std::nothrow) Show_parse_tree(parent_show_parent_tree));
413 } else
414 m_show_parse_tree = nullptr;
415 }
416};
417
418/**
419 Environment data for the contextualization phase
420*/
422 THD *const thd; ///< Current thread handler
423 MEM_ROOT *mem_root; ///< Current MEM_ROOT
424 Query_block *select; ///< Current Query_block object
425 mem_root_deque<QueryLevel> m_stack; ///< Aids query term tree construction
426 /// Call upon parse completion.
427 /// @returns true on error, else false
428 bool finalize_query_expression();
429 Parse_context(THD *thd, Query_block *sl, bool show_parse_tree,
430 Show_parse_tree *parent_show_parent_tree);
431 Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree = false)
432 : Parse_context(thd_arg, sl_arg, show_parse_tree, nullptr) {}
433 Parse_context(THD *thd_arg, Query_block *sl_arg,
434 Show_parse_tree *parent_show_parent_tree)
435 : Parse_context(thd_arg, sl_arg, parent_show_parent_tree != nullptr,
436 parent_show_parent_tree) {}
437
438 bool is_top_level_union_all(
439 Surrounding_context op); ///< Determine if there is anything but
440 ///< UNION ALL above in m_stack
441};
442
444
445#endif /* PARSE_TREE_NODE_BASE_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
bool check_stack_overrun(const THD *thd, long margin, unsigned char *buf)
Check stack for a overrun.
Definition: check_stack.cc:110
Base class that is common to all subqueries and subquery predicates.
Definition: item_subselect.h:80
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
Json_dom * get(std::string_view key) const
Return the value at key.
Definition: json_dom.cc:849
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:231
Parse_tree_node_tmpl(const Parse_tree_node_tmpl &)
Context context_t
Definition: parse_tree_node_base.h:244
Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos)
Definition: parse_tree_node_base.h:264
virtual bool contextualize(Context *pc) final
Definition: parse_tree_node_base.h:320
bool is_contextualized() const
Definition: parse_tree_node_base.h:310
void operator=(const Parse_tree_node_tmpl &)
virtual ~Parse_tree_node_tmpl()=default
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:345
void error(Context *pc, const POS &pos, const char *msg) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:357
Parse_tree_node_tmpl()=delete
virtual void add_json_info(Json_object *json_obj)
Add all the node-specific json fields.
Definition: parse_tree_node_base.h:304
virtual bool do_contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:284
bool end_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:399
Parse_tree_node_tmpl(const POS &pos)
Definition: parse_tree_node_base.h:262
bool contextualized
Definition: parse_tree_node_base.h:240
void errorf(Context *pc, const POS &pos, const char *format,...) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:374
bool begin_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:384
POS m_pos
Definition: parse_tree_node_base.h:245
Base class for all top-level nodes of SQL statements.
Definition: parse_tree_nodes.h:163
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1170
Query term tree structure.
Definition: query_term.h:216
Holds the json parse tree being generated by the SHOW PARSE_TREE command.
Definition: parse_tree_node_base.h:140
bool make_child(Json_object *obj)
Make the obj a child of the current parent object in the object stack.
Definition: parse_tree_node_base.cc:178
static constexpr Parse_tree_comparator m_comparator
Definition: parse_tree_node_base.h:165
std::string get_parse_tree()
Generate the json tree text from the json tree, and return it.
Definition: parse_tree_node_base.cc:159
Show_parse_tree(Show_parse_tree *parent_tree=nullptr)
Definition: parse_tree_node_base.h:182
bool push_level(const POS &pos, const char *typname)
Create a json node out of the parse tree node position and type name, and push it onto the json objec...
Definition: parse_tree_node_base.cc:113
Json_object * pop_json_object()
Pop the current object in the object stack, and return it.
Definition: parse_tree_node_base.cc:141
std::vector< Json_object * > m_json_obj_stack
Definition: parse_tree_node_base.h:142
const char * m_reference_pos
Definition: parse_tree_node_base.h:148
Show_parse_tree * m_parent_show_parse_tree
Definition: parse_tree_node_base.h:144
bool pop_level()
Pop out the json node pushed by push_level() and make it a child of the inner json object in the stac...
Definition: parse_tree_node_base.h:224
Json_object * get_current_parent()
Get the current object under which new json objects are to be added as children.
Definition: parse_tree_node_base.h:204
Json_object_ptr m_root_obj
Definition: parse_tree_node_base.h:143
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
JSON DOM.
std::unique_ptr< Json_dom > Json_dom_ptr
Definition: json_dom.h:64
std::unique_ptr< Json_object > Json_object_ptr
Definition: json_dom.h:66
Various macros useful for communicating with memory debuggers, such as Valgrind.
void TRASH(void *ptr, size_t length)
Put bad content in memory to be sure it will segfault if dereferenced.
Definition: memory_debugging.h:71
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Header for compiler-dependent features.
#define MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE(X)
Definition: my_compiler.h:247
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:277
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:278
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
std::string format(const routing_guidelines::Session_info &session_info, bool extended_session_info)
Definition: dest_metadata_cache.cc:170
size_t size(const char *const c)
Definition: base64.h:46
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:61
@ CTX_QEP_TAB
Definition: parse_tree_node_base.h:70
@ CTX_SIMPLE_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:84
@ CTX_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:79
@ CTX_HAVING
Inside HAVING condition.
Definition: parse_tree_node_base.h:77
@ CTX_UNARY_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:96
@ CTX_BUFFER_RESULT
see SQL_BUFFER_RESULT in the manual
Definition: parse_tree_node_base.h:85
@ CTX_MESSAGE
"No tables used" messages etc.
Definition: parse_tree_node_base.h:63
@ CTX_UNION_RESULT
Pseudo-table context for UNION result.
Definition: parse_tree_node_base.h:90
@ CTX_DERIVED
"Derived" subquery
Definition: parse_tree_node_base.h:73
@ CTX_EXCEPT
Definition: parse_tree_node_base.h:93
@ CTX_SELECT_LIST
SELECT (subquery), (subquery)...
Definition: parse_tree_node_base.h:65
@ CTX_ORDER_BY_SQ
Subquery in ORDER BY clause item tree.
Definition: parse_tree_node_base.h:86
@ CTX_UNARY
Definition: parse_tree_node_base.h:95
@ CTX_QUALIFY
Inside QUALIFY condition.
Definition: parse_tree_node_base.h:78
@ CTX_SIMPLE_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:81
@ CTX_SIMPLE_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:82
@ CTX_INTERSECT
Definition: parse_tree_node_base.h:91
@ CTX_INSERT_UPDATE
INSERT ... ON DUPLICATE KEY UPDATE ...
Definition: parse_tree_node_base.h:68
@ CTX_GROUP_BY_SQ
Subquery in GROUP BY clause item tree.
Definition: parse_tree_node_base.h:87
@ CTX_INTERSECT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:92
@ CTX_MATERIALIZATION
Definition: parse_tree_node_base.h:71
@ CTX_NONE
Empty value.
Definition: parse_tree_node_base.h:62
@ CTX_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:83
@ CTX_UPDATE_VALUE
UPDATE ... SET field=(subquery)...
Definition: parse_tree_node_base.h:66
@ CTX_DUPLICATES_WEEDOUT
Definition: parse_tree_node_base.h:72
@ CTX_JOIN
Definition: parse_tree_node_base.h:69
@ CTX_OPTIMIZED_AWAY_SUBQUERY
Subquery executed once during optimization.
Definition: parse_tree_node_base.h:88
@ CTX_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:80
@ CTX_QUERY_SPEC
Inner SELECTs of UNION expression.
Definition: parse_tree_node_base.h:97
@ CTX_TABLE
for single-table UPDATE/DELETE/INSERT/REPLACE
Definition: parse_tree_node_base.h:64
@ CTX_INSERT_VALUES
INSERT ... VALUES.
Definition: parse_tree_node_base.h:67
@ CTX_WHERE
Inside WHERE condition.
Definition: parse_tree_node_base.h:74
@ CTX_WINDOW
Named or unnamed window.
Definition: parse_tree_node_base.h:76
@ CTX_ON
Inside ON condition.
Definition: parse_tree_node_base.h:75
@ CTX_UNION
Definition: parse_tree_node_base.h:89
@ CTX_EXCEPT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:94
Surrounding_context
Definition: parse_tree_node_base.h:101
@ SC_SUBQUERY
Definition: parse_tree_node_base.h:106
@ SC_QUERY_EXPRESSION
Definition: parse_tree_node_base.h:105
@ SC_EXCEPT_ALL
Definition: parse_tree_node_base.h:112
@ SC_TABLE_VALUE_CONSTRUCTOR
Definition: parse_tree_node_base.h:104
@ SC_TOP
Definition: parse_tree_node_base.h:102
@ SC_INTERSECT_ALL
Definition: parse_tree_node_base.h:110
@ SC_QUERY_SPECIFICATION
Definition: parse_tree_node_base.h:103
@ SC_EXCEPT_DISTINCT
Definition: parse_tree_node_base.h:111
@ SC_UNION_DISTINCT
Definition: parse_tree_node_base.h:107
@ SC_UNION_ALL
Definition: parse_tree_node_base.h:108
@ SC_INTERSECT_DISTINCT
Definition: parse_tree_node_base.h:109
Parse_tree_node_tmpl< Parse_context > Parse_tree_node
Definition: parse_tree_node_base.h:443
File containing constants that can be used throughout the server.
constexpr const long STACK_MIN_SIZE
Stack reservation.
Definition: sql_const.h:144
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:145
Bison "location" class.
Definition: parse_location.h:43
Symbol_location cpp
Definition: parse_location.h:44
Symbol_location raw
Definition: parse_location.h:45
Definition: parse_tree_node_base.h:404
Parse_context_base(bool show_parse_tree=false, Show_parse_tree *parent_show_parent_tree=nullptr)
Definition: parse_tree_node_base.h:407
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:421
Parse_context(THD *thd_arg, Query_block *sl_arg, Show_parse_tree *parent_show_parent_tree)
Definition: parse_tree_node_base.h:433
Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree=false)
Definition: parse_tree_node_base.h:431
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:424
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:422
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:423
mem_root_deque< QueryLevel > m_stack
Aids query term tree construction.
Definition: parse_tree_node_base.h:425
Definition: parse_tree_node_base.h:115
QueryLevel(MEM_ROOT *mem_root, Surrounding_context sc, bool has_order=false)
Definition: parse_tree_node_base.h:119
mem_root_deque< Query_term * > m_elts
Definition: parse_tree_node_base.h:117
bool m_has_order
Definition: parse_tree_node_base.h:118
Surrounding_context m_type
Definition: parse_tree_node_base.h:116
Definition: parse_tree_node_base.h:155
bool operator()(const Json_dom_ptr &a, const Json_dom_ptr &b) const
Definition: parse_tree_node_base.h:156
const char * start
Definition: parse_location.h:33
const char * end
Definition: parse_location.h:34