24 #ifndef _SP_PCONTEXT_H_ 25 #define _SP_PCONTEXT_H_ 28 #include <sys/types.h> 119 : name(_name), ip(_ip), type(_type), ctx(_ctx) {}
153 DBUG_ASSERT(type != ERROR_CODE && type != SQLSTATE);
184 : name(_name), value(_value) {}
212 : type(_type), scope(_scope) {}
217 void print_conditions(
String *str)
const;
289 size_t diff_handlers(
const sp_pcontext *ctx,
bool exclusive)
const;
301 size_t diff_cursors(
const sp_pcontext *ctx,
bool exclusive)
const;
315 return m_var_offset +
static_cast<uint>(m_vars.size());
354 sp_variable *find_variable(
const char *name,
size_t name_len,
355 bool current_scope_only)
const;
381 if (m_case_expr_ids.push_back(m_num_case_exprs))
return -1;
383 return m_num_case_exprs++;
401 if (!label && m_parent) label = m_parent->last_label();
416 bool current_scope_only)
const;
459 bool find_cursor(
LEX_STRING name,
uint *poff,
bool current_scope_only)
const;
465 return m_max_cursor_index +
static_cast<uint>(m_cursors.size());
469 return m_cursor_offset +
static_cast<uint>(m_cursors.size());
479 void init(
uint var_offset,
uint cursor_offset,
int num_case_expressions);
Definition: sp_pcontext.h:195
uint current_cursor_count() const
Definition: sp_pcontext.h:468
This file contains the field type.
static void print(const char *key, int keylen, const char *val, int vallen)
Print the key value pair.
Definition: mcstat.c:106
sp_label * last_label()
Definition: sp_pcontext.h:398
Item * default_value
Default value of the SP-variable (if any).
Definition: sp_pcontext.h:68
sp_pcontext * parent_context() const
Definition: sp_pcontext.h:275
Definition: mysql_lex_string.h:34
sp_pcontext * scope
BEGIN..END block of the handler.
Definition: sp_pcontext.h:201
Definition: sp_pcontext.h:49
sp_condition(LEX_STRING _name, sp_condition_value *_value)
Definition: sp_pcontext.h:183
Definition: sp_pcontext.h:49
bool equals(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, bool *equals, bool *null) noexcept
Computes the equals relation between two geometries.
Definition: equals.cc:739
This class represents an SQL/PSM label.
Definition: sp_pcontext.h:92
uint context_var_count() const
Definition: sp_pcontext.h:319
uint m_max_cursor_index
The maximum sub context's framesizes.
Definition: sp_pcontext.h:499
Definition: mysql_lex_string.h:39
int push_case_expr_id()
Definition: sp_pcontext.h:380
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:191
This class represents 'DECLARE CONDITION' statement.
Definition: sp_pcontext.h:174
Mem_root_array< LEX_STRING > m_cursors
Stack of cursors.
Definition: sp_pcontext.h:533
sp_pcontext * m_parent
Parent context.
Definition: sp_pcontext.h:502
int get_level() const
Definition: sp_pcontext.h:277
List< const sp_condition_value > condition_values
Conditions caught by this handler.
Definition: sp_pcontext.h:204
REGULAR_SCOPE designates regular BEGIN ... END blocks.
Definition: sp_pcontext.h:254
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:164
enum_type type
Handler type.
Definition: sp_pcontext.h:198
Label at BEGIN.
Definition: sp_pcontext.h:99
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:570
Common definition between mysql server & client.
List< sp_label > m_labels
List of labels.
Definition: sp_pcontext.h:539
uint var_context2runtime(uint i) const
Definition: sp_pcontext.h:322
LEX_CSTRING name
Name of the label.
Definition: sp_pcontext.h:106
uint m_max_var_index
m_max_var_index – number of variables (including all types of arguments) in this context including a...
Definition: sp_pcontext.h:496
enum_type
Definition: sp_pcontext.h:94
#define SQLSTATE_LENGTH
Definition: mysql_com.h:75
#define DBUG_ASSERT(A)
Definition: my_dbug.h:199
enum_type type
Type of the condition value.
Definition: sp_pcontext.h:136
Mem_root_array< sp_variable * > m_vars
SP parameters/variables.
Definition: sp_pcontext.h:524
enum_type
Enumeration of possible handler types.
Definition: sp_pcontext.h:195
void declare_var_boundary(uint n)
Set the current scope boundary (for default values).
Definition: sp_pcontext.h:372
enum_mode
Definition: sp_pcontext.h:49
sp_label(LEX_CSTRING _name, uint _ip, enum_type _type, sp_pcontext *_ctx)
Definition: sp_pcontext.h:118
sp_condition_value * value
Value of the condition.
Definition: sp_pcontext.h:180
Mem_root_array< int > m_case_expr_ids
Stack of CASE expression ids.
Definition: sp_pcontext.h:527
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements...
Definition: sp_pcontext.h:131
The class represents parse-time context, which keeps track of declared variables/parameters, conditions, handlers, cursors and labels.
Definition: sp_pcontext.h:250
uint offset
The index to the variable's value in the runtime frame.
Definition: sp_pcontext.h:65
sp_variable(LEX_STRING _name, enum_field_types _type, enum_mode _mode, uint _offset)
Definition: sp_pcontext.h:74
enum_field_types
Column types for MySQL.
Definition: field_types.h:52
This class represents a stored program variable or a parameter (also referenced as 'SP-variable')...
Definition: sp_pcontext.h:47
unsigned int uint
Definition: uca-dump.cc:29
LEX_STRING name
Name of the SP-variable.
Definition: sp_pcontext.h:52
Definition: sp_pcontext.h:133
int get_current_case_expr_id() const
Definition: sp_pcontext.h:388
uint m_cursor_offset
Cursor offset for this context.
Definition: sp_pcontext.h:513
Implicit label generated by parser.
Definition: sp_pcontext.h:96
class sp_pcontext * ctx
Scope of the label.
Definition: sp_pcontext.h:115
sp_condition_value(const char *_sql_state)
Definition: sp_pcontext.h:147
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:416
uint max_var_index() const
Definition: sp_pcontext.h:310
void pop_case_expr_id()
Definition: sp_pcontext.h:386
Mem_root_array< sp_condition * > m_conditions
Stack of SQL-conditions.
Definition: sp_pcontext.h:530
enum enum_field_types type
Field-type of the SP-variable.
Definition: sp_pcontext.h:55
Definition: sp_pcontext.h:49
sp_handler(enum_type _type, sp_pcontext *_scope)
The constructor.
Definition: sp_pcontext.h:211
int m_num_case_exprs
Definition: sp_pcontext.h:521
enum_type
Definition: sp_pcontext.h:133
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:49
char sql_state[64]
Definition: test_sql_9_sessions.cc:297
enum_mode mode
Mode of the SP-variable.
Definition: sp_pcontext.h:58
sp_condition_value(uint _mysqlerr)
Definition: sp_pcontext.h:145
int n
Definition: xcom_base.cc:442
enum_scope m_scope
Scope of this parsing context.
Definition: sp_pcontext.h:545
sp_condition_value(enum_type _type)
Definition: sp_pcontext.h:152
enum_scope
Definition: sp_pcontext.h:252
const string value("\alue\)
Mem_root_array< sp_pcontext * > m_children
Children contexts, used for destruction.
Definition: sp_pcontext.h:542
uint mysqlerr
MySQL error code of the condition value.
Definition: sp_pcontext.h:142
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:58
Mem_root_array< sp_handler * > m_handlers
Stack of SQL-handlers.
Definition: sp_pcontext.h:536
enum_type type
Type of the label.
Definition: sp_pcontext.h:112
LEX_STRING name
Name of the condition.
Definition: sp_pcontext.h:177
uint current_var_count() const
Definition: sp_pcontext.h:314
int m_level
Level of the corresponding BEGIN..END block (0 means the topmost block).
Definition: sp_pcontext.h:487
uint ip
Instruction pointer of the label.
Definition: sp_pcontext.h:109
uint m_var_offset
An index of the first SP-variable in this parsing context.
Definition: sp_pcontext.h:510
sp_label * pop_label()
Definition: sp_pcontext.h:406
uint max_cursor_index() const
Definition: sp_pcontext.h:464
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:803
Dialog Client Authentication nullptr
Definition: dialog.cc:353
uint m_pboundary
Boundary for finding variables in this context.
Definition: sp_pcontext.h:519
int get_num_case_exprs() const
Definition: sp_pcontext.h:378
Create_field field_def
Full type information (field meta-data) of the SP-variable.
Definition: sp_pcontext.h:71