24#ifndef PARSE_TREE_HELPERS_INCLUDED
25#define PARSE_TREE_HELPERS_INCLUDED
55template <
typename Element_type>
118 if (item->itemize(pc, &item))
return true;
131 if (item ==
nullptr)
return true;
132 value.push_back(item);
141 if (item ==
nullptr)
return true;
142 value.push_front(item);
167template <
typename Context,
typename Array>
169 for (
auto it : *array) {
170 if (pc->thd->lex->will_contextualize && it->contextualize(pc))
return true;
185template <
class To, Item_func::Functype Tag>
189 ?
static_cast<To *
>(from)
210template <
class Class, Item_func::Functype Tag>
213 if (left ==
nullptr || right ==
nullptr)
return nullptr;
214 Class *left_func = item_cond_cast<Class, Tag>(left);
215 Class *right_func = item_cond_cast<Class, Tag>(right);
219 right_func->add_at_head(left_func->argument_list());
223 left_func->add(right);
226 }
else if (right_func) {
228 right_func->add_at_head(left);
232 return new (
mem_root) Class(pos, left, right);
238 const char *query_start_ptr,
239 const char *
start,
const char *
end);
Definition: item_func.h:100
virtual enum Functype functype() const
Definition: item_func.h:366
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
Type
Definition: item.h:965
@ INVALID_ITEM
Definition: item.h:966
@ COND_ITEM
An AND or OR condition.
Definition: item.h:978
virtual enum Type type() const =0
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
bool is_empty() const
Definition: parse_tree_helpers.h:123
Item * operator[](uint index) const
Definition: parse_tree_helpers.h:153
mem_root_deque< Item * > value
Definition: parse_tree_helpers.h:113
Parse_tree_node super
Definition: parse_tree_helpers.h:106
Item * pop_front()
Definition: parse_tree_helpers.h:146
PT_item_list(const POS &pos)
Definition: parse_tree_helpers.h:109
bool push_front(Item *item)
Definition: parse_tree_helpers.h:136
bool push_back(Item *item)
Definition: parse_tree_helpers.h:126
PT_item_list(const POS &start_pos, const POS &end_pos)
Definition: parse_tree_helpers.h:110
uint elements() const
Definition: parse_tree_helpers.h:124
bool do_contextualize(Parse_context *pc) override
Definition: parse_tree_helpers.h:115
Definition: parse_tree_nodes.h:821
Definition: parse_tree_nodes.h:1487
Base class for parse-time Item objects.
Definition: parse_tree_helpers.h:70
enum Type type() const override
Definition: parse_tree_helpers.h:74
Parse_tree_item(const POS &pos)
Definition: parse_tree_helpers.h:72
double val_real() override
Definition: parse_tree_helpers.h:75
my_decimal * val_decimal(my_decimal *) override
Definition: parse_tree_helpers.h:87
bool get_date(MYSQL_TIME *, uint) override
Definition: parse_tree_helpers.h:91
String * val_str(String *) override
Definition: parse_tree_helpers.h:83
bool get_time(MYSQL_TIME *) override
Definition: parse_tree_helpers.h:95
longlong val_int() override
Definition: parse_tree_helpers.h:79
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:231
virtual bool do_contextualize(Context *pc)
Do all context-sensitive things and mark the node as contextualized.
Definition: parse_tree_node_base.h:283
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:63
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
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
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:96
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:49
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
A better implementation of the UNIX ctype(3) library.
int my_strcasecmp(const CHARSET_INFO *cs, const char *s1, const char *s2)
Definition: m_ctype.h:651
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1554
Some integer typedefs for easier portability.
long long int longlong
Definition: my_inttypes.h:55
Time declarations shared between the server and client API: you should not add anything to this heade...
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1569
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
bool is_temp_table(const HA_CREATE_INFO &ci)
Definition: sql_table.cc:230
Type
Definition: resource_group_basic_types.h:33
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
LEX_CSTRING make_string(THD *thd, const char *start_ptr, const char *end_ptr)
Make a new string allocated on THD's mem-root.
Definition: parse_tree_helpers.cc:137
Item_splocal * create_item_for_sp_var(THD *thd, LEX_CSTRING name, class sp_variable *spv, const char *query_start_ptr, const char *start, const char *end)
Create an object to represent a SP variable in the Item-hierarchy.
Definition: parse_tree_helpers.cc:82
bool sp_create_assignment_instr(THD *thd, const char *expr_end_ptr)
Create a SP instruction for a SET assignment.
Definition: parse_tree_helpers.cc:205
bool apply_privileges(THD *thd, const Mem_root_array< class PT_role_or_privilege * > &privs)
This helper function is responsible for aggregating grants from parser tokens to containers and masks...
Definition: parse_tree_helpers.cc:320
void sp_create_assignment_lex(THD *thd, const char *option_ptr)
Definition: parse_tree_helpers.cc:142
Item * flatten_associative_operator(MEM_ROOT *mem_root, const POS &pos, Item *left, Item *right)
Flatten associative operators at parse time.
Definition: parse_tree_helpers.h:211
bool validate_vcpu_range(const resourcegroups::Range &range)
Definition: parse_tree_helpers.cc:376
bool check_resource_group_name_len(const LEX_CSTRING &name, Sql_condition::enum_severity_level severity)
Definition: parse_tree_helpers.cc:424
bool resolve_engine(THD *thd, const LEX_CSTRING &name, bool is_temp_table, bool strict, handlerton **ret)
Resolve engine by its name.
Definition: parse_tree_helpers.cc:291
bool contextualize_array(Context *pc, Array *array)
Contextualize a Mem_root_array of parse tree nodes of the type PTN.
Definition: parse_tree_helpers.h:168
To * item_cond_cast(Item *const from)
Helper function to imitate dynamic_cast for Item_cond hierarchy.
Definition: parse_tree_helpers.h:186
bool validate_resource_group_priority(THD *thd, int *priority, const LEX_CSTRING &name, const resourcegroups::Type &type)
Definition: parse_tree_helpers.cc:387
bool check_resource_group_support()
Definition: parse_tree_helpers.cc:414
bool is_identifier(const char *str, const char *ident)
Definition: parse_tree_helpers.h:249
void move_cf_appliers(Parse_context *tddlpc, Column_parse_context *cpc)
Definition: parse_tree_helpers.cc:439
Set_operator
Definition: parser_yystype.h:339
required uint32 priority
Definition: replication_group_member_actions.proto:35
required string type
Definition: replication_group_member_actions.proto:34
"public" interface to sys_var - server configuration variables.
case opt name
Definition: sslopt-case.h:29
Parse context for column type attribute specific parse tree nodes.
Definition: parse_tree_column_attrs.h:73
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40
Definition: mysql_lex_string.h:35
Definition: mysql_time.h:82
Bison "location" class.
Definition: parse_location.h:43
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2740
Definition: gen_lex_token.cc:149
Definition: resource_group_basic_types.h:34