23#ifndef PARSE_TREE_NODE_BASE_INCLUDED
24#define PARSE_TREE_NODE_BASE_INCLUDED
44#define UNCACHEABLE_DEPENDENT 1
45#define UNCACHEABLE_RAND 2
46#define UNCACHEABLE_SIDEEFFECT 4
48#define UNCACHEABLE_UNITED 8
49#define UNCACHEABLE_CHECKOPTION 16
101template <
typename Context>
117 const std::nothrow_t &arg
118 [[maybe_unused]] = std::nothrow)
noexcept {
121 static void operator delete(
void *ptr [[maybe_unused]],
122 size_t size [[maybe_unused]]) {
126 const std::nothrow_t &)
noexcept {}
170 pc->thd->syntax_error_at(
pos);
182 pc->thd->syntax_error_at(
pos,
"%s", msg);
193 void errorf(Context *pc,
const POS &
pos,
const char *format, ...) const
194 MY_ATTRIBUTE((format(printf, 4, 5)));
197template <typename Context>
202 va_start(args, format);
203 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:74
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:102
Parse_tree_node_tmpl(const Parse_tree_node_tmpl &)
Context context_t
Definition: parse_tree_node_base.h:114
virtual bool contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:150
bool is_contextualized() const
Definition: parse_tree_node_base.h:139
void operator=(const Parse_tree_node_tmpl &)
virtual ~Parse_tree_node_tmpl()=default
Parse_tree_node_tmpl()
Definition: parse_tree_node_base.h:129
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:169
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:181
bool contextualized
Definition: parse_tree_node_base.h:110
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:198
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1124
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
char * pos
Definition: do_ctype.cc:76
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.
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:55
@ CTX_QEP_TAB
Definition: parse_tree_node_base.h:64
@ CTX_SIMPLE_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:77
@ CTX_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:72
@ CTX_HAVING
Subquery in HAVING clause item tree.
Definition: parse_tree_node_base.h:71
@ CTX_BUFFER_RESULT
see SQL_BUFFER_RESULT in the manual
Definition: parse_tree_node_base.h:78
@ CTX_MESSAGE
"No tables used" messages etc.
Definition: parse_tree_node_base.h:57
@ CTX_UNION_RESULT
Pseudo-table context for UNION result.
Definition: parse_tree_node_base.h:83
@ CTX_DERIVED
"Derived" subquery
Definition: parse_tree_node_base.h:67
@ CTX_SELECT_LIST
SELECT (subquery), (subquery)...
Definition: parse_tree_node_base.h:59
@ CTX_ORDER_BY_SQ
Subquery in ORDER BY clause item tree.
Definition: parse_tree_node_base.h:79
@ CTX_SIMPLE_ORDER_BY
ORDER BY clause execution context.
Definition: parse_tree_node_base.h:74
@ CTX_SIMPLE_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:75
@ CTX_INSERT_UPDATE
INSERT ... ON DUPLICATE KEY UPDATE ...
Definition: parse_tree_node_base.h:62
@ CTX_GROUP_BY_SQ
Subquery in GROUP BY clause item tree.
Definition: parse_tree_node_base.h:80
@ CTX_MATERIALIZATION
Definition: parse_tree_node_base.h:65
@ CTX_NONE
Empty value.
Definition: parse_tree_node_base.h:56
@ CTX_DISTINCT
DISTINCT clause execution context.
Definition: parse_tree_node_base.h:76
@ CTX_UPDATE_VALUE
UPDATE ... SET field=(subquery)...
Definition: parse_tree_node_base.h:60
@ CTX_DUPLICATES_WEEDOUT
Definition: parse_tree_node_base.h:66
@ CTX_JOIN
Definition: parse_tree_node_base.h:63
@ CTX_OPTIMIZED_AWAY_SUBQUERY
Subquery executed once during optimization.
Definition: parse_tree_node_base.h:81
@ CTX_GROUP_BY
GROUP BY clause execution context.
Definition: parse_tree_node_base.h:73
@ CTX_QUERY_SPEC
Inner SELECTs of UNION expression.
Definition: parse_tree_node_base.h:84
@ CTX_TABLE
for single-table UPDATE/DELETE/INSERT/REPLACE
Definition: parse_tree_node_base.h:58
@ CTX_INSERT_VALUES
INSERT ... VALUES.
Definition: parse_tree_node_base.h:61
@ CTX_WHERE
Subquery in WHERE clause item tree.
Definition: parse_tree_node_base.h:68
@ CTX_WINDOW
Named or unnamed window.
Definition: parse_tree_node_base.h:70
@ CTX_ON
ON clause context.
Definition: parse_tree_node_base.h:69
@ CTX_UNION
Definition: parse_tree_node_base.h:82
Parse_tree_node_tmpl< Parse_context > Parse_tree_node
Definition: parse_tree_node_base.h:207
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
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:90
Query_block * select
Current Query_block object.
Definition: parse_tree_node_base.h:93
Parse_context(THD *thd, Query_block *sl)
Definition: parse_tree_node_base.cc:27
THD *const thd
Current thread handler.
Definition: parse_tree_node_base.h:91
MEM_ROOT * mem_root
Current MEM_ROOT.
Definition: parse_tree_node_base.h:92
Bison "location" class.
Definition: parse_location.h:42