24#ifndef _SP_PCONTEXT_H_
25#define _SP_PCONTEXT_H_
356 bool current_scope_only)
const;
417 bool current_scope_only)
const;
480 void init(uint var_offset, uint cursor_offset,
int num_case_expressions);
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:50
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Definition: sql_list.h:433
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:425
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:62
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements.
Definition: sp_pcontext.h:132
bool equals(const sp_condition_value *cv) const
Check if two instances of sp_condition_value are equal or not.
Definition: sp_pcontext.cc:34
sp_condition_value(const char *_sql_state)
Definition: sp_pcontext.h:148
char sql_state[SQLSTATE_LENGTH+1]
SQLSTATE of the condition value.
Definition: sp_pcontext.h:140
sp_condition_value(enum_type _type)
Definition: sp_pcontext.h:153
uint mysqlerr
MySQL error code of the condition value.
Definition: sp_pcontext.h:143
void print(String *str) const
Print a condition_value in human-readable form.
Definition: sp_pcontext.cc:53
enum_type type
Type of the condition value.
Definition: sp_pcontext.h:137
sp_condition_value(uint _mysqlerr)
Definition: sp_pcontext.h:146
enum_type
Definition: sp_pcontext.h:134
@ ERROR_CODE
Definition: sp_pcontext.h:134
@ SQLSTATE
Definition: sp_pcontext.h:134
@ EXCEPTION
Definition: sp_pcontext.h:134
@ NOT_FOUND
Definition: sp_pcontext.h:134
@ WARNING
Definition: sp_pcontext.h:134
This class represents 'DECLARE CONDITION' statement.
Definition: sp_pcontext.h:175
sp_condition_value * value
Value of the condition.
Definition: sp_pcontext.h:181
sp_condition(LEX_STRING _name, sp_condition_value *_value)
Definition: sp_pcontext.h:184
LEX_STRING name
Name of the condition.
Definition: sp_pcontext.h:178
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:192
sp_handler(enum_type _type, sp_pcontext *_scope)
The constructor.
Definition: sp_pcontext.h:212
void print_conditions(String *str) const
Print all conditions of a handler in human-readable form.
Definition: sp_pcontext.cc:78
enum_type
Enumeration of possible handler types.
Definition: sp_pcontext.h:196
@ EXIT
Definition: sp_pcontext.h:196
@ CONTINUE
Definition: sp_pcontext.h:196
void print(String *str) const
Print type and conditions (but not body) of a handler.
Definition: sp_pcontext.cc:91
List< const sp_condition_value > condition_values
Conditions caught by this handler.
Definition: sp_pcontext.h:205
enum_type type
Handler type.
Definition: sp_pcontext.h:199
sp_pcontext * scope
BEGIN..END block of the handler.
Definition: sp_pcontext.h:202
This class represents an SQL/PSM label.
Definition: sp_pcontext.h:93
LEX_CSTRING name
Name of the label.
Definition: sp_pcontext.h:107
sp_label(LEX_CSTRING _name, uint _ip, enum_type _type, sp_pcontext *_ctx)
Definition: sp_pcontext.h:119
enum_type type
Type of the label.
Definition: sp_pcontext.h:113
class sp_pcontext * ctx
Scope of the label.
Definition: sp_pcontext.h:116
uint ip
Instruction pointer of the label.
Definition: sp_pcontext.h:110
enum_type
Definition: sp_pcontext.h:95
@ IMPLICIT
Implicit label generated by parser.
Definition: sp_pcontext.h:97
@ ITERATION
Label at iteration control.
Definition: sp_pcontext.h:103
@ BEGIN
Label at BEGIN.
Definition: sp_pcontext.h:100
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:251
sp_pcontext(THD *thd)
Definition: sp_pcontext.cc:116
int get_current_case_expr_id() const
Definition: sp_pcontext.h:389
uint m_pboundary
Boundary for finding variables in this context.
Definition: sp_pcontext.h:520
uint m_max_cursor_index
The maximum sub context's framesizes.
Definition: sp_pcontext.h:500
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:191
uint context_var_count() const
Definition: sp_pcontext.h:320
int get_num_case_exprs() const
Definition: sp_pcontext.h:379
int m_num_case_exprs
Definition: sp_pcontext.h:522
List< sp_label > m_labels
List of labels.
Definition: sp_pcontext.h:540
sp_condition_value * find_condition(LEX_STRING name, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:286
uint current_var_count() const
Definition: sp_pcontext.h:315
sp_pcontext(const sp_pcontext &)
Mem_root_array< sp_variable * > m_vars
SP parameters/variables.
Definition: sp_pcontext.h:525
Mem_root_array< sp_pcontext * > m_children
Children contexts, used for destruction.
Definition: sp_pcontext.h:543
sp_pcontext * m_parent
Parent context.
Definition: sp_pcontext.h:503
void declare_var_boundary(uint n)
Set the current scope boundary (for default values).
Definition: sp_pcontext.h:373
sp_pcontext * push_context(THD *thd, enum_scope scope)
Create and push a new context in the tree.
Definition: sp_pcontext.cc:154
int push_case_expr_id()
Definition: sp_pcontext.h:381
uint m_cursor_offset
Cursor offset for this context.
Definition: sp_pcontext.h:514
void pop_case_expr_id()
Definition: sp_pcontext.h:387
uint m_var_offset
An index of the first SP-variable in this parsing context.
Definition: sp_pcontext.h:511
bool add_cursor(LEX_STRING name)
Definition: sp_pcontext.cc:422
enum_scope
Definition: sp_pcontext.h:253
@ HANDLER_SCOPE
HANDLER_SCOPE designates SQL-handler blocks.
Definition: sp_pcontext.h:258
@ REGULAR_SCOPE
REGULAR_SCOPE designates regular BEGIN ... END blocks.
Definition: sp_pcontext.h:255
int m_level
Level of the corresponding BEGIN..END block (0 means the topmost block).
Definition: sp_pcontext.h:488
uint max_cursor_index() const
Definition: sp_pcontext.h:465
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:312
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:232
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:205
bool add_condition(THD *thd, LEX_STRING name, sp_condition_value *value)
Definition: sp_pcontext.cc:277
uint max_var_index() const
Definition: sp_pcontext.h:311
sp_handler * add_handler(THD *thd, sp_handler::enum_type type)
Definition: sp_pcontext.cc:304
uint var_context2runtime(uint i) const
Definition: sp_pcontext.h:323
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:497
void init(uint var_offset, uint cursor_offset, int num_case_expressions)
Definition: sp_pcontext.cc:107
uint current_cursor_count() const
Definition: sp_pcontext.h:469
sp_label * push_label(THD *thd, LEX_CSTRING name, uint ip)
Definition: sp_pcontext.cc:245
int get_level() const
Definition: sp_pcontext.h:278
Mem_root_array< sp_condition * > m_conditions
Stack of SQL-conditions.
Definition: sp_pcontext.h:531
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:447
Mem_root_array< LEX_STRING > m_cursors
Stack of cursors.
Definition: sp_pcontext.h:534
bool find_cursor(LEX_STRING name, uint *poff, bool current_scope_only) const
See comment for find_variable() above.
Definition: sp_pcontext.cc:428
sp_label * find_label(LEX_CSTRING name)
Definition: sp_pcontext.cc:256
Mem_root_array< int > m_case_expr_ids
Stack of CASE expression ids.
Definition: sp_pcontext.h:528
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:328
sp_label * last_label()
Definition: sp_pcontext.h:399
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:175
sp_pcontext * parent_context() const
Definition: sp_pcontext.h:276
sp_pcontext * pop_context()
Pop a node from the parsing context tree.
Definition: sp_pcontext.cc:162
sp_label * pop_label()
Definition: sp_pcontext.h:407
enum_scope m_scope
Scope of this parsing context.
Definition: sp_pcontext.h:546
Mem_root_array< sp_handler * > m_handlers
Stack of SQL-handlers.
Definition: sp_pcontext.h:537
void operator=(sp_pcontext &)
~sp_pcontext()
Definition: sp_pcontext.cc:150
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:48
Item * default_value
Default value of the SP-variable (if any).
Definition: sp_pcontext.h:69
enum_mode mode
Mode of the SP-variable.
Definition: sp_pcontext.h:59
LEX_STRING name
Name of the SP-variable.
Definition: sp_pcontext.h:53
enum_mode
Definition: sp_pcontext.h:50
@ MODE_OUT
Definition: sp_pcontext.h:50
@ MODE_IN
Definition: sp_pcontext.h:50
@ MODE_INOUT
Definition: sp_pcontext.h:50
Create_field field_def
Full type information (field meta-data) of the SP-variable.
Definition: sp_pcontext.h:72
sp_variable(LEX_STRING _name, enum_field_types _type, enum_mode _mode, uint _offset)
Definition: sp_pcontext.h:75
uint offset
The index to the variable's value in the runtime frame.
Definition: sp_pcontext.h:66
enum enum_field_types type
Field-type of the SP-variable.
Definition: sp_pcontext.h:56
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
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:54
Common definition between mysql server & client.
#define SQLSTATE_LENGTH
Definition: mysql_com.h:74
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
mode
Definition: file_handle.h:59
required string type
Definition: replication_group_member_actions.proto:33
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39
Definition: mysql_lex_string.h:34
int n
Definition: xcom_base.cc:508