MySQL 8.4.0
Source Code Documentation
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
235 void operator=(const Parse_tree_node_tmpl &); // undefined
236
237#ifndef NDEBUG
238 private:
239 bool contextualized = false; // true if the node object is contextualized
240#endif // NDEBUG
241
242 public:
243 typedef Context context_t;
244 POS m_pos; // Grammar position. is_empty() if node not created in parser.
245
246 static void *operator new(size_t size, MEM_ROOT *mem_root,
247 const std::nothrow_t &arg
248 [[maybe_unused]] = std::nothrow) noexcept {
249 return mem_root->Alloc(size);
250 }
251 static void operator delete(void *ptr [[maybe_unused]],
252 size_t size [[maybe_unused]]) {
253 TRASH(ptr, size);
254 }
255 static void operator delete(void *, MEM_ROOT *,
256 const std::nothrow_t &) noexcept {}
257
258 protected:
260
261 explicit Parse_tree_node_tmpl(const POS &pos) : m_pos(pos) {}
262
263 explicit Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos) {
264 // Range of this item list should be from first character position of
265 // start_pos to the last character position of end_pos.
266 m_pos.cpp.start = start_pos.cpp.start;
267 m_pos.cpp.end = end_pos.cpp.end;
268 m_pos.raw.start = start_pos.raw.start;
269 m_pos.raw.end = end_pos.raw.end;
270 }
271
274
275 /**
276 Do all context-sensitive things and mark the node as contextualized
277
278 @param pc current parse context
279
280 @retval false success
281 @retval true syntax/OOM/etc error
282 */
283 virtual bool do_contextualize(Context *pc) {
284 uchar dummy;
285 if (check_stack_overrun(pc->thd, STACK_MIN_SIZE, &dummy)) return true;
286
287#ifndef NDEBUG
288 assert(!contextualized);
289 contextualized = true;
290#endif // NDEBUG
291
292 return false;
293 }
294
295 /**
296 Add all the node-specific json fields. Any class that needs to add such
297 info should override this function rather than doing it in
298 do_contextualize(). E.g. the parse tree node for AVG() may have "distinct"
299 field to indicate if AVG(DISTINCT ...) is used or not.
300
301 @param json_obj Json object for this parse tree node.
302 */
303 virtual void add_json_info(Json_object *json_obj [[maybe_unused]]) {}
304
305 public:
306 virtual ~Parse_tree_node_tmpl() = default;
307
308#ifndef NDEBUG
309 bool is_contextualized() const { return contextualized; }
310#endif // NDEBUG
311
312 // Derived classes should not override this. If needed, they should override
313 // do_contextualize().
314 // Visual Studio with MSVC_CPPCHECK=ON gives warning C26435:
315 // Function <fun> should specify exactly one of
316 // 'virtual', 'override', or 'final'
319 virtual bool contextualize(Context *pc) final {
320 // For condition#2 below ... If position is empty, this item was not
321 // created in the parser; so don't show it in the parse tree.
322 if (pc->m_show_parse_tree == nullptr || this->m_pos.is_empty())
323 return do_contextualize(pc);
324
325 Show_parse_tree *tree = pc->m_show_parse_tree.get();
326
327 if (begin_parse_tree(tree)) return true;
328
329 if (do_contextualize(pc)) return true;
330
331 if (end_parse_tree(tree)) return true;
332
333 return false;
334 }
336
337 /**
338 syntax_error() function replacement for deferred reporting of syntax
339 errors
340
341 @param pc Current parse context.
342 @param pos Location of the error in lexical scanner buffers.
343 */
344 void error(Context *pc, const POS &pos) const {
345 pc->thd->syntax_error_at(pos);
346 }
347
348 /**
349 syntax_error() function replacement for deferred reporting of syntax
350 errors
351
352 @param pc Current parse context.
353 @param pos Location of the error in lexical scanner buffers.
354 @param msg Error message.
355 */
356 void error(Context *pc, const POS &pos, const char *msg) const {
357 pc->thd->syntax_error_at(pos, "%s", msg);
358 }
359
360 /**
361 syntax_error() function replacement for deferred reporting of syntax
362 errors
363
364 @param pc Current parse context.
365 @param pos Location of the error in lexical scanner buffers.
366 @param format Error message format string with optional argument list.
367 */
368 void errorf(Context *pc, const POS &pos, const char *format, ...) const
369 MY_ATTRIBUTE((format(printf, 4, 5)));
370};
371
372template <typename Context>
373inline void Parse_tree_node_tmpl<Context>::errorf(Context *pc, const POS &pos,
374 const char *format,
375 ...) const {
376 va_list args;
377 va_start(args, format);
378 pc->thd->vsyntax_error_at(pos, format, args);
379 va_end(args);
380}
381
382template <typename Context>
384 if (tree == nullptr) return false;
385 if (tree->push_level(this->m_pos, typeid(*this).name())) return true;
386
387 // Add node-specific fields. Do it here rather than in end_parse_tree() : We
388 // want to show field values *before* they get changed in contextualization.
389 // E.g. join type can change from left to right join.
390 Json_object *json_obj = tree->get_current_parent();
391 assert(json_obj != nullptr);
392 add_json_info(json_obj);
393
394 return false;
395}
396
397template <typename Context>
399 if (tree == nullptr) return false;
400 return tree->pop_level();
401}
402
404 std::unique_ptr<Show_parse_tree> m_show_parse_tree = nullptr;
405
407 bool show_parse_tree = false,
408 Show_parse_tree *parent_show_parent_tree = nullptr) {
409 if (show_parse_tree) {
410 m_show_parse_tree = std::unique_ptr<Show_parse_tree>(
411 new (std::nothrow) Show_parse_tree(parent_show_parent_tree));
412 } else
413 m_show_parse_tree = nullptr;
414 }
415};
416
417/**
418 Environment data for the contextualization phase
419*/
421 THD *const thd; ///< Current thread handler
422 MEM_ROOT *mem_root; ///< Current MEM_ROOT
423 Query_block *select; ///< Current Query_block object
424 mem_root_deque<QueryLevel> m_stack; ///< Aids query term tree construction
425 /// Call upon parse completion.
426 /// @returns true on error, else false
427 bool finalize_query_expression();
428 Parse_context(THD *thd, Query_block *sl, bool show_parse_tree,
429 Show_parse_tree *parent_show_parent_tree);
430 Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree = false)
431 : Parse_context(thd_arg, sl_arg, show_parse_tree, nullptr) {}
432 Parse_context(THD *thd_arg, Query_block *sl_arg,
433 Show_parse_tree *parent_show_parent_tree)
434 : Parse_context(thd_arg, sl_arg, parent_show_parent_tree != nullptr,
435 parent_show_parent_tree) {}
436
437 bool is_top_level_union_all(
438 Surrounding_context op); ///< Determine if there is anything but
439 ///< UNION ALL above in m_stack
440};
441
443
444#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 used to represent any kind of expression in a relational query.
Definition: item.h:934
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
Json_dom * get(const std::string &key) const
Return the value at key.
Definition: json_dom.cc:866
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:243
Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos)
Definition: parse_tree_node_base.h:263
virtual bool contextualize(Context *pc) final
Definition: parse_tree_node_base.h:319
bool is_contextualized() const
Definition: parse_tree_node_base.h:309
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:344
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:356
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:303
virtual bool do_contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:283
bool end_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:398
Parse_tree_node_tmpl(const POS &pos)
Definition: parse_tree_node_base.h:261
bool contextualized
Definition: parse_tree_node_base.h:239
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:373
bool begin_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:383
POS m_pos
Definition: parse_tree_node_base.h:244
Base class for all top-level nodes of SQL statements.
Definition: parse_tree_nodes.h:161
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1163
Query term tree structure.
Definition: query_term.h:209
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:65
std::unique_ptr< Json_object > Json_object_ptr
Definition: json_dom.h:67
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:255
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:285
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:286
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
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:442
File containing constants that can be used throughout the server.
constexpr const long STACK_MIN_SIZE
Stack reservation.
Definition: sql_const.h:143
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:403
Parse_context_base(bool show_parse_tree=false, Show_parse_tree *parent_show_parent_tree=nullptr)
Definition: parse_tree_node_base.h:406
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420
Parse_context(THD *thd_arg, Query_block *sl_arg, Show_parse_tree *parent_show_parent_tree)
Definition: parse_tree_node_base.h:432
Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree=false)
Definition: parse_tree_node_base.h:430
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:423
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:421
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:422
mem_root_deque< QueryLevel > m_stack
Aids query term tree construction.
Definition: parse_tree_node_base.h:424
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