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