25#ifndef _SP_PCONTEXT_H_
26#define _SP_PCONTEXT_H_
357 bool current_scope_only)
const;
418 bool current_scope_only)
const;
481 void init(uint var_offset, uint cursor_offset,
int num_case_expressions);
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:51
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
Definition: sql_list.h:467
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
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
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements.
Definition: sp_pcontext.h:133
bool equals(const sp_condition_value *cv) const
Check if two instances of sp_condition_value are equal or not.
Definition: sp_pcontext.cc:37
sp_condition_value(const char *_sql_state)
Definition: sp_pcontext.h:149
char sql_state[SQLSTATE_LENGTH+1]
SQLSTATE of the condition value.
Definition: sp_pcontext.h:141
sp_condition_value(enum_type _type)
Definition: sp_pcontext.h:154
uint mysqlerr
MySQL error code of the condition value.
Definition: sp_pcontext.h:144
void print(String *str) const
Print a condition_value in human-readable form.
Definition: sp_pcontext.cc:56
enum_type type
Type of the condition value.
Definition: sp_pcontext.h:138
sp_condition_value(uint _mysqlerr)
Definition: sp_pcontext.h:147
enum_type
Definition: sp_pcontext.h:135
@ ERROR_CODE
Definition: sp_pcontext.h:135
@ SQLSTATE
Definition: sp_pcontext.h:135
@ EXCEPTION
Definition: sp_pcontext.h:135
@ NOT_FOUND
Definition: sp_pcontext.h:135
@ WARNING
Definition: sp_pcontext.h:135
This class represents 'DECLARE CONDITION' statement.
Definition: sp_pcontext.h:176
sp_condition_value * value
Value of the condition.
Definition: sp_pcontext.h:182
sp_condition(LEX_STRING _name, sp_condition_value *_value)
Definition: sp_pcontext.h:185
LEX_STRING name
Name of the condition.
Definition: sp_pcontext.h:179
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:193
sp_handler(enum_type _type, sp_pcontext *_scope)
The constructor.
Definition: sp_pcontext.h:213
void print_conditions(String *str) const
Print all conditions of a handler in human-readable form.
Definition: sp_pcontext.cc:81
enum_type
Enumeration of possible handler types.
Definition: sp_pcontext.h:197
@ EXIT
Definition: sp_pcontext.h:197
@ CONTINUE
Definition: sp_pcontext.h:197
void print(String *str) const
Print type and conditions (but not body) of a handler.
Definition: sp_pcontext.cc:94
List< const sp_condition_value > condition_values
Conditions caught by this handler.
Definition: sp_pcontext.h:206
enum_type type
Handler type.
Definition: sp_pcontext.h:200
sp_pcontext * scope
BEGIN..END block of the handler.
Definition: sp_pcontext.h:203
This class represents an SQL/PSM label.
Definition: sp_pcontext.h:94
LEX_CSTRING name
Name of the label.
Definition: sp_pcontext.h:108
sp_label(LEX_CSTRING _name, uint _ip, enum_type _type, sp_pcontext *_ctx)
Definition: sp_pcontext.h:120
enum_type type
Type of the label.
Definition: sp_pcontext.h:114
class sp_pcontext * ctx
Scope of the label.
Definition: sp_pcontext.h:117
uint ip
Instruction pointer of the label.
Definition: sp_pcontext.h:111
enum_type
Definition: sp_pcontext.h:96
@ IMPLICIT
Implicit label generated by parser.
Definition: sp_pcontext.h:98
@ ITERATION
Label at iteration control.
Definition: sp_pcontext.h:104
@ BEGIN
Label at BEGIN.
Definition: sp_pcontext.h:101
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:252
sp_pcontext(THD *thd)
Definition: sp_pcontext.cc:119
int get_current_case_expr_id() const
Definition: sp_pcontext.h:390
uint m_pboundary
Boundary for finding variables in this context.
Definition: sp_pcontext.h:521
uint m_max_cursor_index
The maximum sub context's framesizes.
Definition: sp_pcontext.h:501
size_t diff_cursors(const sp_pcontext *ctx, bool exclusive) const
Calculate and return the number of cursors to pop between the given context and this one.
Definition: sp_pcontext.cc:194
uint context_var_count() const
Definition: sp_pcontext.h:321
int get_num_case_exprs() const
Definition: sp_pcontext.h:380
int m_num_case_exprs
Definition: sp_pcontext.h:523
List< sp_label > m_labels
List of labels.
Definition: sp_pcontext.h:541
sp_condition_value * find_condition(LEX_STRING name, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:289
uint current_var_count() const
Definition: sp_pcontext.h:316
sp_pcontext(const sp_pcontext &)
Mem_root_array< sp_variable * > m_vars
SP parameters/variables.
Definition: sp_pcontext.h:526
Mem_root_array< sp_pcontext * > m_children
Children contexts, used for destruction.
Definition: sp_pcontext.h:544
sp_pcontext * m_parent
Parent context.
Definition: sp_pcontext.h:504
void declare_var_boundary(uint n)
Set the current scope boundary (for default values).
Definition: sp_pcontext.h:374
sp_pcontext * push_context(THD *thd, enum_scope scope)
Create and push a new context in the tree.
Definition: sp_pcontext.cc:157
int push_case_expr_id()
Definition: sp_pcontext.h:382
uint m_cursor_offset
Cursor offset for this context.
Definition: sp_pcontext.h:515
void pop_case_expr_id()
Definition: sp_pcontext.h:388
uint m_var_offset
An index of the first SP-variable in this parsing context.
Definition: sp_pcontext.h:512
bool add_cursor(LEX_STRING name)
Definition: sp_pcontext.cc:425
enum_scope
Definition: sp_pcontext.h:254
@ HANDLER_SCOPE
HANDLER_SCOPE designates SQL-handler blocks.
Definition: sp_pcontext.h:259
@ REGULAR_SCOPE
REGULAR_SCOPE designates regular BEGIN ... END blocks.
Definition: sp_pcontext.h:256
int m_level
Level of the corresponding BEGIN..END block (0 means the topmost block).
Definition: sp_pcontext.h:489
uint max_cursor_index() const
Definition: sp_pcontext.h:466
bool check_duplicate_handler(const sp_condition_value *cond_value) const
This is an auxiliary parsing-time function to check if an SQL-handler exists in the current parsing c...
Definition: sp_pcontext.cc:315
sp_variable * add_variable(THD *thd, LEX_STRING name, enum enum_field_types type, sp_variable::enum_mode mode)
Add SP-variable to the parsing context.
Definition: sp_pcontext.cc:235
sp_variable * find_variable(const char *name, size_t name_len, bool current_scope_only) const
Find SP-variable by name.
Definition: sp_pcontext.cc:208
bool add_condition(THD *thd, LEX_STRING name, sp_condition_value *value)
Definition: sp_pcontext.cc:280
uint max_var_index() const
Definition: sp_pcontext.h:312
sp_handler * add_handler(THD *thd, sp_handler::enum_type type)
Definition: sp_pcontext.cc:307
uint var_context2runtime(uint i) const
Definition: sp_pcontext.h:324
uint m_max_var_index
m_max_var_index – number of variables (including all types of arguments) in this context including al...
Definition: sp_pcontext.h:498
void init(uint var_offset, uint cursor_offset, int num_case_expressions)
Definition: sp_pcontext.cc:110
uint current_cursor_count() const
Definition: sp_pcontext.h:470
sp_label * push_label(THD *thd, LEX_CSTRING name, uint ip)
Definition: sp_pcontext.cc:248
int get_level() const
Definition: sp_pcontext.h:279
Mem_root_array< sp_condition * > m_conditions
Stack of SQL-conditions.
Definition: sp_pcontext.h:532
void retrieve_field_definitions(List< Create_field > *field_def_lst) const
Retrieve full type information about SP-variables in this parsing context and its children.
Definition: sp_pcontext.cc:450
Mem_root_array< LEX_STRING > m_cursors
Stack of cursors.
Definition: sp_pcontext.h:535
bool find_cursor(LEX_STRING name, uint *poff, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:431
sp_label * find_label(LEX_CSTRING name)
Definition: sp_pcontext.cc:259
Mem_root_array< int > m_case_expr_ids
Stack of CASE expression ids.
Definition: sp_pcontext.h:529
sp_handler * find_handler(const char *sql_state, uint sql_errno, Sql_condition::enum_severity_level severity) const
Find an SQL handler for the given SQL condition according to the SQL-handler resolution rules.
Definition: sp_pcontext.cc:331
sp_label * last_label()
Definition: sp_pcontext.h:400
size_t diff_handlers(const sp_pcontext *ctx, bool exclusive) const
Calculate and return the number of handlers to pop between the given context and this one.
Definition: sp_pcontext.cc:178
sp_pcontext * parent_context() const
Definition: sp_pcontext.h:277
sp_pcontext * pop_context()
Pop a node from the parsing context tree.
Definition: sp_pcontext.cc:165
sp_label * pop_label()
Definition: sp_pcontext.h:408
enum_scope m_scope
Scope of this parsing context.
Definition: sp_pcontext.h:547
Mem_root_array< sp_handler * > m_handlers
Stack of SQL-handlers.
Definition: sp_pcontext.h:538
void operator=(sp_pcontext &)
~sp_pcontext()
Definition: sp_pcontext.cc:153
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:49
Item * default_value
Default value of the SP-variable (if any).
Definition: sp_pcontext.h:70
enum_mode mode
Mode of the SP-variable.
Definition: sp_pcontext.h:60
LEX_STRING name
Name of the SP-variable.
Definition: sp_pcontext.h:54
enum_mode
Definition: sp_pcontext.h:51
@ MODE_OUT
Definition: sp_pcontext.h:51
@ MODE_IN
Definition: sp_pcontext.h:51
@ MODE_INOUT
Definition: sp_pcontext.h:51
Create_field field_def
Full type information (field meta-data) of the SP-variable.
Definition: sp_pcontext.h:73
sp_variable(LEX_STRING _name, enum_field_types _type, enum_mode _mode, uint _offset)
Definition: sp_pcontext.h:76
uint offset
The index to the variable's value in the runtime frame.
Definition: sp_pcontext.h:67
enum enum_field_types type
Field-type of the SP-variable.
Definition: sp_pcontext.h:57
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
Common definition between mysql server & client.
#define SQLSTATE_LENGTH
Definition: mysql_com.h:75
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
mode
Definition: file_handle.h:61
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
Definition: mysql_lex_string.h:40
Definition: mysql_lex_string.h:35
int n
Definition: xcom_base.cc:509