MySQL 8.3.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, ///< Inside WHERE condition
74 CTX_ON, ///< Inside ON condition
75 CTX_WINDOW, ///< Named or unnamed window
76 CTX_HAVING, ///< Inside HAVING condition
77 CTX_QUALIFY, ///< Inside QUALIFY condition
78 CTX_ORDER_BY, ///< ORDER BY clause execution context
79 CTX_GROUP_BY, ///< GROUP BY clause execution context
80 CTX_SIMPLE_ORDER_BY, ///< ORDER BY clause execution context
81 CTX_SIMPLE_GROUP_BY, ///< GROUP BY clause execution context
82 CTX_DISTINCT, ///< DISTINCT clause execution context
83 CTX_SIMPLE_DISTINCT, ///< DISTINCT clause execution context
84 CTX_BUFFER_RESULT, ///< see SQL_BUFFER_RESULT in the manual
85 CTX_ORDER_BY_SQ, ///< Subquery in ORDER BY clause item tree
86 CTX_GROUP_BY_SQ, ///< Subquery in GROUP BY clause item tree
87 CTX_OPTIMIZED_AWAY_SUBQUERY, ///< Subquery executed once during optimization
89 CTX_UNION_RESULT, ///< Pseudo-table context for UNION result
91 CTX_INTERSECT_RESULT, ///< Pseudo-table context
93 CTX_EXCEPT_RESULT, ///< Pseudo-table context
95 CTX_UNARY_RESULT, ///< Pseudo-table context
96 CTX_QUERY_SPEC ///< Inner SELECTs of UNION expression
97};
98
99class Query_term;
113
117 bool m_has_order{false};
118 QueryLevel(MEM_ROOT *mem_root, Surrounding_context sc, bool has_order = false)
119 : m_type(sc), m_elts(mem_root), m_has_order(has_order) {}
120};
121
122class Json_object;
123class Parse_tree_root;
124
125/**
126 Holds the json parse tree being generated by the SHOW PARSE_TREE command.
127
128 The json tree gets built with the help of the two parse tree node walkers
129 namely contextualize() and itemize(). Each contextualize() (or itemize())
130 creates a new json subtree. In the beginning of contextualize(),
131 push_level() is called, where a new Json object is created and pushed to
132 m_json_obj_stack. This object now becomes a parent json object to which all
133 the subtrees created by the inner contextualize() calls will be added as
134 its children. Each contextualize() will end with a call to pop_level() where
135 the current parent will be popped out and made the child of the now-current
136 parent object in the stack. This way the json tree is built identical to the
137 tree of Parse_tree_node's.
138*/
140 private:
141 std::vector<Json_object *> m_json_obj_stack{};
144
145 // Reference position for calculating relative positions of objects in the
146 // grammar.
147 const char *m_reference_pos = nullptr;
148
149 // Comparator to sort Json_array using 'startpos' field. The children needs
150 // to be sorted in the order they occur in the syntax, in order to help
151 // generate the original SQL back from the json tree. The order of the
152 // contextualize() calls is not guaranteed to be in the syntax order of the
153 // objects whose contextualize() functions are called. Hence, the sorting.
155 bool operator()(const Json_dom_ptr &a, const Json_dom_ptr &b) const {
156 const Json_object *obj_a = down_cast<const Json_object *>(a.get());
157 const Json_object *obj_b = down_cast<const Json_object *>(b.get());
158
159 longlong inta = down_cast<Json_int *>(obj_a->get("startpos"))->value();
160 longlong intb = down_cast<Json_int *>(obj_b->get("startpos"))->value();
161 return inta < intb;
162 }
163 };
164 static constexpr Parse_tree_comparator m_comparator = {};
165
166 /**
167 Make the obj a child of the current parent object in the object stack.
168
169 @param obj Input json object resembling a parse tree node.
170
171 @retval false: success; true: error
172 */
173 bool make_child(Json_object *obj);
174
175 /**
176 Pop the current object in the object stack, and return it.
177 */
179
180 public:
181 explicit Show_parse_tree(Show_parse_tree *parent_tree = nullptr)
182 : m_parent_show_parse_tree(parent_tree) {}
183
184 /**
185 Create a json node out of the parse tree node position and type name, and
186 push it onto the json object stack. Effectively, a new json stack level is
187 created, to which json children would be added.
188
189 @param pos syntax position of the parse tree node
190 @param typname type name of the class of the parse tree node
191
192 @retval false success
193 @retval true error
194 */
195 bool push_level(const POS &pos, const char *typname);
196
197 /**
198 Get the current object under which new json objects are to be added as
199 children. Effectively, this is the outermost object in the object stack.
200
201 retval nullptr if the object stack is empty.
202 */
204 return m_json_obj_stack.empty()
205 ? nullptr
206 : static_cast<Json_object *>(m_json_obj_stack.back());
207 }
208
209 /**
210 Generate the json tree text from the json tree, and return it.
211
212 @retval non-empty success
213 @retval empty error
214 */
215 std::string get_parse_tree();
216
217 /**
218 Pop out the json node pushed by push_level() and make it a child of the
219 inner json object in the stack.
220
221 @retval false: success; true: error
222 */
224};
225
226/**
227 Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
228*/
229template <typename Context>
231 friend class Item; // for direct access to the "contextualized" field
232
234 void operator=(const Parse_tree_node_tmpl &); // undefined
235
236#ifndef NDEBUG
237 private:
238 bool contextualized = false; // true if the node object is contextualized
239#endif // NDEBUG
240
241 public:
242 typedef Context context_t;
243 POS m_pos; // Grammar position. is_empty() if node not created in parser.
244
245 static void *operator new(size_t size, MEM_ROOT *mem_root,
246 const std::nothrow_t &arg
247 [[maybe_unused]] = std::nothrow) noexcept {
248 return mem_root->Alloc(size);
249 }
250 static void operator delete(void *ptr [[maybe_unused]],
251 size_t size [[maybe_unused]]) {
252 TRASH(ptr, size);
253 }
254 static void operator delete(void *, MEM_ROOT *,
255 const std::nothrow_t &) noexcept {}
256
257 protected:
259
260 explicit Parse_tree_node_tmpl(const POS &pos) : m_pos(pos) {}
261
262 explicit Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos) {
263 // Range of this item list should be from first character position of
264 // start_pos to the last character position of end_pos.
265 m_pos.cpp.start = start_pos.cpp.start;
266 m_pos.cpp.end = end_pos.cpp.end;
267 m_pos.raw.start = start_pos.raw.start;
268 m_pos.raw.end = end_pos.raw.end;
269 }
270
273
274 /**
275 Do all context-sensitive things and mark the node as contextualized
276
277 @param pc current parse context
278
279 @retval false success
280 @retval true syntax/OOM/etc error
281 */
282 virtual bool do_contextualize(Context *pc) {
283 uchar dummy;
284 if (check_stack_overrun(pc->thd, STACK_MIN_SIZE, &dummy)) return true;
285
286#ifndef NDEBUG
287 assert(!contextualized);
288 contextualized = true;
289#endif // NDEBUG
290
291 return false;
292 }
293
294 /**
295 Add all the node-specific json fields. Any class that needs to add such
296 info should override this function rather than doing it in
297 do_contextualize(). E.g. the parse tree node for AVG() may have "distinct"
298 field to indicate if AVG(DISTINCT ...) is used or not.
299
300 @param json_obj Json object for this parse tree node.
301 */
302 virtual void add_json_info(Json_object *json_obj [[maybe_unused]]) {}
303
304 public:
305 virtual ~Parse_tree_node_tmpl() = default;
306
307#ifndef NDEBUG
308 bool is_contextualized() const { return contextualized; }
309#endif // NDEBUG
310
311 // Derived classes should not override this. If needed, they should override
312 // do_contextualize().
313 // Visual Studio with MSVC_CPPCHECK=ON gives warning C26435:
314 // Function <fun> should specify exactly one of
315 // 'virtual', 'override', or 'final'
318 virtual bool contextualize(Context *pc) final {
319 // For condition#2 below ... If position is empty, this item was not
320 // created in the parser; so don't show it in the parse tree.
321 if (pc->m_show_parse_tree == nullptr || this->m_pos.is_empty())
322 return do_contextualize(pc);
323
324 Show_parse_tree *tree = pc->m_show_parse_tree.get();
325
326 if (begin_parse_tree(tree)) return true;
327
328 if (do_contextualize(pc)) return true;
329
330 if (end_parse_tree(tree)) return true;
331
332 return false;
333 }
335
336 /**
337 syntax_error() function replacement for deferred reporting of syntax
338 errors
339
340 @param pc Current parse context.
341 @param pos Location of the error in lexical scanner buffers.
342 */
343 void error(Context *pc, const POS &pos) const {
344 pc->thd->syntax_error_at(pos);
345 }
346
347 /**
348 syntax_error() function replacement for deferred reporting of syntax
349 errors
350
351 @param pc Current parse context.
352 @param pos Location of the error in lexical scanner buffers.
353 @param msg Error message.
354 */
355 void error(Context *pc, const POS &pos, const char *msg) const {
356 pc->thd->syntax_error_at(pos, "%s", msg);
357 }
358
359 /**
360 syntax_error() function replacement for deferred reporting of syntax
361 errors
362
363 @param pc Current parse context.
364 @param pos Location of the error in lexical scanner buffers.
365 @param format Error message format string with optional argument list.
366 */
367 void errorf(Context *pc, const POS &pos, const char *format, ...) const
368 MY_ATTRIBUTE((format(printf, 4, 5)));
369};
370
371template <typename Context>
372inline void Parse_tree_node_tmpl<Context>::errorf(Context *pc, const POS &pos,
373 const char *format,
374 ...) const {
375 va_list args;
376 va_start(args, format);
377 pc->thd->vsyntax_error_at(pos, format, args);
378 va_end(args);
379}
380
381template <typename Context>
383 if (tree == nullptr) return false;
384 if (tree->push_level(this->m_pos, typeid(*this).name())) return true;
385
386 // Add node-specific fields. Do it here rather than in end_parse_tree() : We
387 // want to show field values *before* they get changed in contextualization.
388 // E.g. join type can change from left to right join.
389 Json_object *json_obj = tree->get_current_parent();
390 assert(json_obj != nullptr);
391 add_json_info(json_obj);
392
393 return false;
394}
395
396template <typename Context>
398 if (tree == nullptr) return false;
399 return tree->pop_level();
400}
401
403 std::unique_ptr<Show_parse_tree> m_show_parse_tree = nullptr;
404
406 bool show_parse_tree = false,
407 Show_parse_tree *parent_show_parent_tree = nullptr) {
408 if (show_parse_tree) {
409 m_show_parse_tree = std::unique_ptr<Show_parse_tree>(
410 new (std::nothrow) Show_parse_tree(parent_show_parent_tree));
411 } else
412 m_show_parse_tree = nullptr;
413 }
414};
415
416/**
417 Environment data for the contextualization phase
418*/
420 THD *const thd; ///< Current thread handler
421 MEM_ROOT *mem_root; ///< Current MEM_ROOT
422 Query_block *select; ///< Current Query_block object
423 mem_root_deque<QueryLevel> m_stack; ///< Aids query term tree construction
424 /// Call upon parse completion.
425 /// @returns true on error, else false
426 bool finalize_query_expression();
427 Parse_context(THD *thd, Query_block *sl, bool show_parse_tree,
428 Show_parse_tree *parent_show_parent_tree);
429 Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree = false)
430 : Parse_context(thd_arg, sl_arg, show_parse_tree, nullptr) {}
431 Parse_context(THD *thd_arg, Query_block *sl_arg,
432 Show_parse_tree *parent_show_parent_tree)
433 : Parse_context(thd_arg, sl_arg, parent_show_parent_tree != nullptr,
434 parent_show_parent_tree) {}
435
436 bool is_top_level_union_all(
437 Surrounding_context op); ///< Determine if there is anything but
438 ///< UNION ALL above in m_stack
439};
440
442
443#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:933
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
Json_dom * get(const std::string &key) const
Return the value at key.
Definition: json_dom.cc:858
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:230
Parse_tree_node_tmpl(const Parse_tree_node_tmpl &)
Context context_t
Definition: parse_tree_node_base.h:242
Parse_tree_node_tmpl(const POS &start_pos, const POS &end_pos)
Definition: parse_tree_node_base.h:262
virtual bool contextualize(Context *pc) final
Definition: parse_tree_node_base.h:318
bool is_contextualized() const
Definition: parse_tree_node_base.h:308
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:343
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:355
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:302
virtual bool do_contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:282
bool end_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:397
Parse_tree_node_tmpl(const POS &pos)
Definition: parse_tree_node_base.h:260
bool contextualized
Definition: parse_tree_node_base.h:238
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:372
bool begin_parse_tree(Show_parse_tree *tree)
Definition: parse_tree_node_base.h:382
POS m_pos
Definition: parse_tree_node_base.h:243
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:139
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:177
static constexpr Parse_tree_comparator m_comparator
Definition: parse_tree_node_base.h:164
std::string get_parse_tree()
Generate the json tree text from the json tree, and return it.
Definition: parse_tree_node_base.cc:158
Show_parse_tree(Show_parse_tree *parent_tree=nullptr)
Definition: parse_tree_node_base.h:181
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:112
Json_object * pop_json_object()
Pop the current object in the object stack, and return it.
Definition: parse_tree_node_base.cc:140
std::vector< Json_object * > m_json_obj_stack
Definition: parse_tree_node_base.h:141
const char * m_reference_pos
Definition: parse_tree_node_base.h:147
Show_parse_tree * m_parent_show_parse_tree
Definition: parse_tree_node_base.h:143
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:223
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:203
Json_object_ptr m_root_obj
Definition: parse_tree_node_base.h:142
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:110
static MEM_ROOT mem_root
Definition: client_plugin.cc:113
JSON DOM.
std::unique_ptr< Json_dom > Json_dom_ptr
Definition: json_dom.h:63
std::unique_ptr< Json_object > Json_object_ptr
Definition: json_dom.h:65
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:83
@ CTX_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:78
@ CTX_HAVING
Inside HAVING condition.
Definition: parse_tree_node_base.h:76
@ CTX_UNARY_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:95
@ CTX_BUFFER_RESULT
see SQL_BUFFER_RESULT in the manual
Definition: parse_tree_node_base.h:84
@ 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:89
@ CTX_DERIVED
"Derived" subquery
Definition: parse_tree_node_base.h:72
@ CTX_EXCEPT
Definition: parse_tree_node_base.h:92
@ 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:85
@ CTX_UNARY
Definition: parse_tree_node_base.h:94
@ CTX_QUALIFY
Inside QUALIFY condition.
Definition: parse_tree_node_base.h:77
@ CTX_SIMPLE_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:80
@ CTX_SIMPLE_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:81
@ CTX_INTERSECT
Definition: parse_tree_node_base.h:90
@ 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:86
@ CTX_INTERSECT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:91
@ 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:82
@ 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:87
@ CTX_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:79
@ CTX_QUERY_SPEC
Inner SELECTs of UNION expression.
Definition: parse_tree_node_base.h:96
@ 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
Inside WHERE condition.
Definition: parse_tree_node_base.h:73
@ CTX_WINDOW
Named or unnamed window.
Definition: parse_tree_node_base.h:75
@ CTX_ON
Inside ON condition.
Definition: parse_tree_node_base.h:74
@ CTX_UNION
Definition: parse_tree_node_base.h:88
@ CTX_EXCEPT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:93
Surrounding_context
Definition: parse_tree_node_base.h:100
@ SC_SUBQUERY
Definition: parse_tree_node_base.h:105
@ SC_QUERY_EXPRESSION
Definition: parse_tree_node_base.h:104
@ SC_EXCEPT_ALL
Definition: parse_tree_node_base.h:111
@ SC_TABLE_VALUE_CONSTRUCTOR
Definition: parse_tree_node_base.h:103
@ SC_TOP
Definition: parse_tree_node_base.h:101
@ SC_INTERSECT_ALL
Definition: parse_tree_node_base.h:109
@ SC_QUERY_SPECIFICATION
Definition: parse_tree_node_base.h:102
@ SC_EXCEPT_DISTINCT
Definition: parse_tree_node_base.h:110
@ SC_UNION_DISTINCT
Definition: parse_tree_node_base.h:106
@ SC_UNION_ALL
Definition: parse_tree_node_base.h:107
@ SC_INTERSECT_DISTINCT
Definition: parse_tree_node_base.h:108
Parse_tree_node_tmpl< Parse_context > Parse_tree_node
Definition: parse_tree_node_base.h:441
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:402
Parse_context_base(bool show_parse_tree=false, Show_parse_tree *parent_show_parent_tree=nullptr)
Definition: parse_tree_node_base.h:405
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:419
Parse_context(THD *thd_arg, Query_block *sl_arg, Show_parse_tree *parent_show_parent_tree)
Definition: parse_tree_node_base.h:431
Parse_context(THD *thd_arg, Query_block *sl_arg, bool show_parse_tree=false)
Definition: parse_tree_node_base.h:429
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:422
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:420
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:421
mem_root_deque< QueryLevel > m_stack
Aids query term tree construction.
Definition: parse_tree_node_base.h:423
Definition: parse_tree_node_base.h:114
QueryLevel(MEM_ROOT *mem_root, Surrounding_context sc, bool has_order=false)
Definition: parse_tree_node_base.h:118
mem_root_deque< Query_term * > m_elts
Definition: parse_tree_node_base.h:116
bool m_has_order
Definition: parse_tree_node_base.h:117
Surrounding_context m_type
Definition: parse_tree_node_base.h:115
Definition: parse_tree_node_base.h:154
bool operator()(const Json_dom_ptr &a, const Json_dom_ptr &b) const
Definition: parse_tree_node_base.h:155
const char * start
Definition: parse_location.h:32
const char * end
Definition: parse_location.h:33