24#ifndef PARSE_TREE_NODE_BASE_INCLUDED
25#define PARSE_TREE_NODE_BASE_INCLUDED
47#define UNCACHEABLE_DEPENDENT 1
48#define UNCACHEABLE_RAND 2
49#define UNCACHEABLE_SIDEEFFECT 4
51#define UNCACHEABLE_UNITED 8
52#define UNCACHEABLE_CHECKOPTION 16
138template <
typename Context>
154 const std::nothrow_t &arg
155 [[maybe_unused]] = std::nothrow)
noexcept {
158 static void operator delete(
void *ptr [[maybe_unused]],
159 size_t size [[maybe_unused]]) {
163 const std::nothrow_t &)
noexcept {}
207 pc->thd->syntax_error_at(pos);
218 void error(Context *pc,
const POS &pos,
const char *msg)
const {
219 pc->thd->syntax_error_at(pos,
"%s", msg);
230 void errorf(Context *pc,
const POS &pos,
const char *format, ...) const
231 MY_ATTRIBUTE((format(printf, 4, 5)));
234template <typename Context>
239 va_start(args, format);
240 pc->thd->vsyntax_error_at(pos, format, args);
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:853
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:139
Parse_tree_node_tmpl(const Parse_tree_node_tmpl &)
Context context_t
Definition: parse_tree_node_base.h:151
virtual bool contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:187
bool is_contextualized() const
Definition: parse_tree_node_base.h:176
void operator=(const Parse_tree_node_tmpl &)
virtual ~Parse_tree_node_tmpl()=default
Parse_tree_node_tmpl()
Definition: parse_tree_node_base.h:166
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:206
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:218
bool contextualized
Definition: parse_tree_node_base.h:147
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:235
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1156
Query term tree structure.
Definition: query_term.h:209
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
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:110
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.
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:58
@ CTX_QEP_TAB
Definition: parse_tree_node_base.h:67
@ CTX_SIMPLE_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:80
@ CTX_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:75
@ CTX_HAVING
Subquery in HAVING clause item tree.
Definition: parse_tree_node_base.h:74
@ CTX_UNARY_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:92
@ CTX_BUFFER_RESULT
see SQL_BUFFER_RESULT in the manual
Definition: parse_tree_node_base.h:81
@ CTX_MESSAGE
"No tables used" messages etc.
Definition: parse_tree_node_base.h:60
@ CTX_UNION_RESULT
Pseudo-table context for UNION result.
Definition: parse_tree_node_base.h:86
@ CTX_DERIVED
"Derived" subquery
Definition: parse_tree_node_base.h:70
@ CTX_EXCEPT
Definition: parse_tree_node_base.h:89
@ CTX_SELECT_LIST
SELECT (subquery), (subquery)...
Definition: parse_tree_node_base.h:62
@ CTX_ORDER_BY_SQ
Subquery in ORDER BY clause item tree.
Definition: parse_tree_node_base.h:82
@ CTX_UNARY
Definition: parse_tree_node_base.h:91
@ CTX_SIMPLE_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:77
@ CTX_SIMPLE_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:78
@ CTX_INTERSECT
Definition: parse_tree_node_base.h:87
@ CTX_INSERT_UPDATE
INSERT ... ON DUPLICATE KEY UPDATE ...
Definition: parse_tree_node_base.h:65
@ CTX_GROUP_BY_SQ
Subquery in GROUP BY clause item tree.
Definition: parse_tree_node_base.h:83
@ CTX_INTERSECT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:88
@ CTX_MATERIALIZATION
Definition: parse_tree_node_base.h:68
@ CTX_NONE
Empty value.
Definition: parse_tree_node_base.h:59
@ CTX_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:79
@ CTX_UPDATE_VALUE
UPDATE ... SET field=(subquery)...
Definition: parse_tree_node_base.h:63
@ CTX_DUPLICATES_WEEDOUT
Definition: parse_tree_node_base.h:69
@ CTX_JOIN
Definition: parse_tree_node_base.h:66
@ CTX_OPTIMIZED_AWAY_SUBQUERY
Subquery executed once during optimization.
Definition: parse_tree_node_base.h:84
@ CTX_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:76
@ CTX_QUERY_SPEC
Inner SELECTs of UNION expression.
Definition: parse_tree_node_base.h:93
@ CTX_TABLE
for single-table UPDATE/DELETE/INSERT/REPLACE
Definition: parse_tree_node_base.h:61
@ CTX_INSERT_VALUES
INSERT ... VALUES.
Definition: parse_tree_node_base.h:64
@ CTX_WHERE
Subquery in WHERE clause item tree.
Definition: parse_tree_node_base.h:71
@ CTX_WINDOW
Named or unnamed window.
Definition: parse_tree_node_base.h:73
@ CTX_ON
ON clause context.
Definition: parse_tree_node_base.h:72
@ CTX_UNION
Definition: parse_tree_node_base.h:85
@ CTX_EXCEPT_RESULT
Pseudo-table context.
Definition: parse_tree_node_base.h:90
Surrounding_context
Definition: parse_tree_node_base.h:97
@ SC_SUBQUERY
Definition: parse_tree_node_base.h:102
@ SC_QUERY_EXPRESSION
Definition: parse_tree_node_base.h:101
@ SC_EXCEPT_ALL
Definition: parse_tree_node_base.h:108
@ SC_TABLE_VALUE_CONSTRUCTOR
Definition: parse_tree_node_base.h:100
@ SC_TOP
Definition: parse_tree_node_base.h:98
@ SC_INTERSECT_ALL
Definition: parse_tree_node_base.h:106
@ SC_QUERY_SPECIFICATION
Definition: parse_tree_node_base.h:99
@ SC_EXCEPT_DISTINCT
Definition: parse_tree_node_base.h:107
@ SC_UNION_DISTINCT
Definition: parse_tree_node_base.h:103
@ SC_UNION_ALL
Definition: parse_tree_node_base.h:104
@ SC_INTERSECT_DISTINCT
Definition: parse_tree_node_base.h:105
Parse_tree_node_tmpl< Parse_context > Parse_tree_node
Definition: parse_tree_node_base.h:244
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
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:121
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:124
Parse_context(THD *thd, Query_block *sl)
Definition: parse_tree_node_base.cc:29
bool is_top_level_union_all(Surrounding_context op)
Determine if there is anything but UNION ALL above in m_stack.
Definition: parse_tree_node_base.cc:53
bool finalize_query_expression()
Call upon parse completion.
Definition: parse_tree_node_base.cc:42
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:122
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:123
mem_root_deque< QueryLevel > m_stack
Aids query term tree construction.
Definition: parse_tree_node_base.h:125
Definition: parse_tree_node_base.h:111
QueryLevel(MEM_ROOT *mem_root, Surrounding_context sc, bool has_order=false)
Definition: parse_tree_node_base.h:115
mem_root_deque< Query_term * > m_elts
Definition: parse_tree_node_base.h:113
bool m_has_order
Definition: parse_tree_node_base.h:114
Surrounding_context m_type
Definition: parse_tree_node_base.h:112
Bison "location" class.
Definition: parse_location.h:43