156#ifdef HAVE_PSI_INTERFACE
511 :
sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
555#ifdef HAVE_PSI_INTERFACE
572 :
sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, is_lex_owner),
631#ifdef HAVE_PSI_INTERFACE
649 :
sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
666 return Instr_type::INSTR_LEX_SET_TRIGGER_FIELD;
698#ifdef HAVE_PSI_INTERFACE
715 :
sp_lex_instr(ip, lex->get_sp_current_parsing_ctx(), lex, true),
779#ifdef HAVE_PSI_INTERFACE
851#ifdef HAVE_PSI_INTERFACE
964 expr_item, expr_query) {}
969 expr_item, expr_query, dest) {}
982 return Instr_type::INSTR_LEX_BRANCH_IF_NOT;
997#ifdef HAVE_PSI_INTERFACE
1018 case_expr_item, case_expr_query),
1036 return Instr_type::INSTR_LEX_BRANCH_SET_CASE_EXPR;
1078#ifdef HAVE_PSI_INTERFACE
1100 when_expr_item, when_expr_query),
1114 return Instr_type::INSTR_LEX_BRANCH_CASE_WHEN;
1166#ifdef HAVE_PSI_INTERFACE
1201 return Instr_type::INSTR_COND_HANDLER_PUSH_JUMP;
1232#ifdef HAVE_PSI_INTERFACE
1262#ifdef HAVE_PSI_INTERFACE
1289 return Instr_type::INSTR_COND_HANDLER_RETURN;
1302#ifdef HAVE_PSI_INTERFACE
1390#ifdef HAVE_PSI_INTERFACE
1426#ifdef HAVE_PSI_INTERFACE
1463#ifdef HAVE_PSI_INTERFACE
1501#ifdef HAVE_PSI_INTERFACE
1544#ifdef HAVE_PSI_INTERFACE
1592#ifdef HAVE_PSI_INTERFACE
static app_data_list nextp(app_data_list l)
Return next element in list of app_data.
Definition: app_data.cc:301
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
void reset_condition_info(THD *thd)
Reset the current condition information stored in the Diagnostics Area.
Definition: sql_error.cc:491
void reset_diagnostics_area()
Clear this Diagnostics Area.
Definition: sql_error.cc:361
Represents NEW/OLD version of field of row which is changed/read in trigger.
Definition: item.h:6798
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:928
Definition: sql_list.h:494
Definition: sql_class.h:348
void free_items()
Definition: sql_class.cc:2120
enum_sql_command sql_command
SQL command for this statement.
Definition: sql_lex.h:2773
Simple intrusive linked list.
Definition: sql_list.h:48
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
bool append(const String &s)
Definition: sql_string.cc:419
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
LEX * lex
Definition: sql_class.h:1002
Diagnostics_area * get_stmt_da()
Returns first Diagnostics Area for the current statement.
Definition: sql_class.h:3340
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4741
An interface for all SP-instructions with destinations that need to be updated by the SP-optimizer.
Definition: sp_instr.h:78
virtual void backpatch(uint dest)=0
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
virtual ~sp_branch_instr()=default
virtual void set_destination(uint old_dest, uint new_dest)=0
Update the destination; used by the SP-instruction-optimizer.
This class represents condition-value term in DECLARE CONDITION or DECLARE HANDLER statements.
Definition: sp_pcontext.h:133
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:193
sp_head represents one instance of a stored program.
Definition: sp_head.h:389
The instruction corresponds to the CLOSE statement.
Definition: sp_instr.h:1478
static PSI_statement_info psi_info
Definition: sp_instr.h:1505
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1495
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1765
sp_instr_cclose(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1480
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1499
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1776
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1503
The instruction corresponds to the FETCH statement.
Definition: sp_instr.h:1516
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1533
List< sp_variable > m_varlist
List of SP-variables to store fetched values.
Definition: sp_instr.h:1539
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1546
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1802
sp_instr_cfetch(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1518
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1813
static PSI_statement_info psi_info
Definition: sp_instr.h:1548
void add_to_varlist(sp_variable *var)
Definition: sp_instr.h:1535
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1542
sp_instr_copen represents OPEN statement (opens the cursor).
Definition: sp_instr.h:1440
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1698
sp_instr_copen(uint ip, sp_pcontext *ctx, int cursor_idx)
Definition: sp_instr.h:1442
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1739
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1457
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1465
static PSI_statement_info psi_info
Definition: sp_instr.h:1467
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1461
sp_instr_cpop instruction is added at the end of BEGIN..END block.
Definition: sp_instr.h:1404
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1421
uint m_count
Definition: sp_instr.h:1424
static PSI_statement_info psi_info
Definition: sp_instr.h:1430
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1428
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1681
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1674
sp_instr_cpop(uint ip, sp_pcontext *ctx, uint count)
Definition: sp_instr.h:1406
sp_instr_cpush corresponds to DECLARE CURSOR, implements DECLARE CURSOR and OPEN.
Definition: sp_instr.h:1331
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1358
bool is_invalid() const override
Definition: sp_instr.h:1366
bool on_after_expr_parsing(THD *) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:1374
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:1368
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1392
static PSI_statement_info psi_info
Definition: sp_instr.h:1394
int m_cursor_idx
Used to identify the cursor in the sp_rcontext.
Definition: sp_instr.h:1388
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1629
void get_query(String *sql_query) const override
Return the query string, which can be passed to the parser.
Definition: sp_instr.h:1370
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1646
LEX_CSTRING m_cursor_query
This attribute keeps the cursor SELECT statement.
Definition: sp_instr.h:1381
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1637
bool m_valid
Flag if the LEX-object of this instruction is valid or not.
Definition: sp_instr.h:1385
sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *cursor_lex, LEX_CSTRING cursor_query, int cursor_idx)
Definition: sp_instr.h:1333
sp_instr_error just throws an SQL-condition if the execution flow comes to it.
Definition: sp_instr.h:1560
bool execute(THD *, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:1575
sp_instr_error(uint ip, sp_pcontext *ctx, int errcode)
Definition: sp_instr.h:1562
int m_errcode
The error code, which should be raised by this instruction.
Definition: sp_instr.h:1590
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1581
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1594
uint opt_mark(sp_head *, List< sp_instr > *) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:1583
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1848
static PSI_statement_info psi_info
Definition: sp_instr.h:1596
sp_instr_freturn represents RETURN statement in stored functions.
Definition: sp_instr.h:711
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:735
LEX_CSTRING m_expr_query
SQL-query corresponding to the RETURN-expression.
Definition: sp_instr.h:774
static PSI_statement_info psi_info
Definition: sp_instr.h:783
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:745
Item * m_expr_item
RETURN-expression item.
Definition: sp_instr.h:771
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1433
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:756
enum enum_field_types m_return_field_type
RETURN-field type code.
Definition: sp_instr.h:777
sp_instr_freturn(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, enum enum_field_types return_field_type)
Definition: sp_instr.h:713
Item * get_expr_item() const
Definition: sp_instr.h:767
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:750
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:781
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1452
bool is_invalid() const override
Definition: sp_instr.h:743
void adjust_sql_command(LEX *lex) override
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:758
uint opt_mark(sp_head *, List< sp_instr > *) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:730
Definition: sp_instr.h:1242
void print(const THD *, String *str) override
Definition: sp_instr.h:1250
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1260
static PSI_statement_info psi_info
Definition: sp_instr.h:1266
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1264
sp_instr_hpop(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:1244
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1548
Definition: sp_instr.h:1178
sp_instr_hpush_jump(uint ip, sp_pcontext *ctx, sp_handler *handler)
Definition: sp_instr.cc:1472
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1496
uint opt_shortcut_jump(sp_head *, sp_instr *) override
Override sp_instr_jump's shortcut; we stop here.
Definition: sp_instr.h:1207
uint m_opt_hpop
hpop marking end of handler scope.
Definition: sp_instr.h:1226
sp_handler * m_handler
Handler.
Definition: sp_instr.h:1223
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1200
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:1213
~sp_instr_hpush_jump() override
Definition: sp_instr.cc:1481
uint m_frame
Definition: sp_instr.h:1230
static PSI_statement_info psi_info
Definition: sp_instr.h:1236
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1490
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1508
void add_condition(sp_condition_value *condition_value)
Definition: sp_instr.cc:1486
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1234
sp_handler * get_handler()
Definition: sp_instr.h:1186
Definition: sp_instr.h:1272
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1304
uint m_frame
Definition: sp_instr.h:1300
static PSI_statement_info psi_info
Definition: sp_instr.h:1306
uint opt_shortcut_jump(sp_head *, sp_instr *) override
Override sp_instr_jump's shortcut; we stop here.
Definition: sp_instr.h:1293
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1602
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1288
sp_instr_hreturn(uint ip, sp_pcontext *ctx)
Definition: sp_instr.cc:1564
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:1567
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1588
sp_instr_jump_case_when instruction is used in the "simple CASE" implementation.
Definition: sp_instr.h:1095
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1373
int m_case_expr_id
Identifier (index) of the CASE-expression in the runtime context.
Definition: sp_instr.h:1154
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1113
static PSI_statement_info psi_info
Definition: sp_instr.h:1170
Item_case_expr * m_case_expr_item
Item representing the CASE-expression.
Definition: sp_instr.h:1157
bool on_after_expr_parsing(THD *thd) override
Build CASE-expression item tree: Item_func_eq(case-expression, when-i-expression)
Definition: sp_instr.cc:1386
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:1123
Item * m_eq_item
Item corresponding to the main item of the jump-condition-expression: it's the equal function (=) in ...
Definition: sp_instr.h:1164
sp_instr_jump_case_when(uint ip, LEX *lex, int case_expr_id, Item *when_expr_item, LEX_CSTRING when_expr_query)
Definition: sp_instr.h:1097
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1168
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1361
sp_instr_jump_if_not implements SP-instruction, which does the jump if its SQL-expression is false.
Definition: sp_instr.h:959
sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query)
Definition: sp_instr.h:961
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:981
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:991
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1290
static PSI_statement_info psi_info
Definition: sp_instr.h:1001
sp_instr_jump_if_not(uint ip, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, uint dest)
Definition: sp_instr.h:966
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:999
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1278
This is base class for all kinds of jump instructions.
Definition: sp_instr.h:799
sp_instr_jump(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:801
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:853
sp_instr * m_optdest
Definition: sp_instr.h:849
sp_instr_jump(uint ip, sp_pcontext *ctx, uint dest)
Definition: sp_instr.h:804
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1237
uint m_dest
Where we will go.
Definition: sp_instr.h:846
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:838
static PSI_statement_info psi_info
Definition: sp_instr.h:855
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1230
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1260
uint opt_shortcut_jump(sp_head *sp, sp_instr *start) override
Short-cut jumps to jumps during optimization.
Definition: sp_instr.cc:1245
bool execute(THD *, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:817
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:834
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:822
sp_instr_set_case_expr is used in the "simple CASE" implementation to evaluate and store the CASE-exp...
Definition: sp_instr.h:1013
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:1056
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1888
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:1035
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1914
static PSI_statement_info psi_info
Definition: sp_instr.h:1082
uint m_case_expr_id
Identifier (index) of the CASE-expression in the runtime context.
Definition: sp_instr.h:1076
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:1068
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:1080
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1865
sp_instr_set_case_expr(uint ip, LEX *lex, uint case_expr_id, Item *case_expr_item, LEX_CSTRING case_expr_query)
Definition: sp_instr.h:1015
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1900
void backpatch(uint) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:1060
sp_instr_set_trigger_field represents SET-statements, which deal with NEW/OLD trigger pseudo-rows.
Definition: sp_instr.h:644
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:665
sp_instr_set_trigger_field(uint ip, LEX *lex, LEX_CSTRING trigger_field_name, Item_trigger_field *trigger_field, Item *value_item, LEX_CSTRING value_query)
Definition: sp_instr.h:646
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.cc:1194
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:700
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1168
bool is_invalid() const override
Definition: sp_instr.h:675
static PSI_statement_info psi_info
Definition: sp_instr.h:702
Item_trigger_field * m_trigger_field
Item corresponding to the NEW/OLD trigger field.
Definition: sp_instr.h:690
void cleanup_before_parsing(THD *thd) override
Destroy items in the free list before re-parsing the statement query string (and thus,...
Definition: sp_instr.cc:1214
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1187
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:677
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:683
LEX_CSTRING m_trigger_field_name
Trigger field name ("field_name" of the "NEW.field_name").
Definition: sp_instr.h:687
LEX_CSTRING m_value_query
SQL-query corresponding to the value expression.
Definition: sp_instr.h:696
Item * m_value_item
Value expression item of the SET-statement.
Definition: sp_instr.h:693
sp_instr_set represents SET-statements, which deal with SP-variables.
Definition: sp_instr.h:568
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:606
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:587
LEX_CSTRING m_value_query
SQL-query corresponding to the value expression.
Definition: sp_instr.h:629
bool on_after_expr_parsing(THD *thd) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:599
void adjust_sql_command(LEX *lex) override
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:608
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1123
sp_instr_set(uint ip, LEX *lex, uint offset, Item *value_item, LEX_CSTRING value_query, bool is_lex_owner)
Definition: sp_instr.h:570
Item * get_value_item()
Definition: sp_instr.h:617
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1140
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:597
Item * m_value_item
Value expression item of the SET-statement.
Definition: sp_instr.h:626
uint get_offset()
Definition: sp_instr.h:619
bool is_invalid() const override
Definition: sp_instr.h:595
static PSI_statement_info psi_info
Definition: sp_instr.h:633
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:634
uint m_offset
Frame offset.
Definition: sp_instr.h:623
sp_instr_stmt represents almost all conventional SQL-statements, which are supported outside stored p...
Definition: sp_instr.h:508
enum Instr_type type() override
Get the instruction type of this instruction.
Definition: sp_instr.h:521
bool is_invalid() const override
Definition: sp_instr.h:535
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:537
void print(const THD *thd, String *str) override
Definition: sp_instr.cc:1069
sp_instr_stmt(uint ip, LEX *lex, LEX_CSTRING query)
Definition: sp_instr.h:510
static PSI_statement_info psi_info
Definition: sp_instr.h:559
bool on_after_expr_parsing(THD *) override
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:543
bool exec_core(THD *thd, uint *nextp) override
Execute core function of instruction after all preparations (e.g.
Definition: sp_instr.cc:1093
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.cc:965
PSI_statement_info * get_psi_info() override
Definition: sp_instr.h:557
bool m_valid
Specify if the stored LEX-object is up-to-date.
Definition: sp_instr.h:553
LEX_CSTRING m_query
Complete query of the SQL-statement.
Definition: sp_instr.h:550
void get_query(String *sql_query) const override
Return the query string, which can be passed to the parser.
Definition: sp_instr.h:539
Base class for every SP-instruction.
Definition: sp_instr.h:105
bool m_marked
Show if this instruction is reachable within the SP (used by SP-optimizer).
Definition: sp_instr.h:227
virtual SQL_I_List< Item_trigger_field > * get_instr_trig_field_list()
Definition: sp_instr.h:218
sp_instr(uint ip, sp_pcontext *ctx)
Definition: sp_instr.h:107
sp_pcontext * m_parsing_ctx
Instruction parsing context.
Definition: sp_instr.h:233
void clear_da(THD *thd) const
Clear diagnostics area.
Definition: sp_instr.h:176
virtual uint opt_shortcut_jump(sp_head *, sp_instr *start)
Short-cut jumps to jumps during optimization.
Definition: sp_instr.h:202
bool opt_is_marked() const
Definition: sp_instr.h:216
virtual uint get_cont_dest() const
Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.
Definition: sp_instr.h:167
virtual uint opt_mark(sp_head *, List< sp_instr > *leads)
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.h:191
void operator=(sp_instr &)
sp_instr(const sp_instr &)
virtual bool execute(THD *thd, uint *nextp)=0
Execute this instruction.
virtual void opt_move(uint dst, List< sp_branch_instr > *ibp)
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.h:212
uint m_ip
Instruction pointer.
Definition: sp_instr.h:230
virtual enum Instr_type type()=0
Get the instruction type of this instruction.
Query_arena m_arena
Definition: sp_instr.h:222
uint get_ip() const
Definition: sp_instr.h:160
virtual PSI_statement_info * get_psi_info()=0
~sp_instr() override
Definition: sp_instr.h:113
sp_pcontext * get_parsing_ctx() const
Definition: sp_instr.h:169
Instr_type
Definition: sp_instr.h:115
@ INSTR_LEX_FRETURN
Definition: sp_instr.h:127
@ INSTR_UNKNOWN
Definition: sp_instr.h:116
@ INSTR_LEX_BRANCH_SET_CASE_EXPR
Definition: sp_instr.h:133
@ INSTR_COND_HANDLER_RETURN
Definition: sp_instr.h:125
@ INSTR_CCLOSE
Definition: sp_instr.h:118
@ INSTR_LEX_BRANCH_IF_NOT
Definition: sp_instr.h:132
@ INSTR_LEX_CPUSH
Definition: sp_instr.h:126
@ INSTR_COND_HANDLER_PUSH_JUMP
Definition: sp_instr.h:124
@ INSTR_LEX_STMT
Definition: sp_instr.h:130
@ INSTR_COPEN
Definition: sp_instr.h:117
@ INSTR_LEX_SET_TRIGGER_FIELD
Definition: sp_instr.h:129
@ INSTR_LEX_SET
Definition: sp_instr.h:128
@ INSTR_HPOP
Definition: sp_instr.h:121
@ INSTR_JUMP
Definition: sp_instr.h:123
@ INSTR_ERROR
Definition: sp_instr.h:122
@ INSTR_CFETCH
Definition: sp_instr.h:119
@ INSTR_CPOP
Definition: sp_instr.h:120
@ INSTR_LEX_BRANCH_CASE_WHEN
Definition: sp_instr.h:131
sp_lex_branch_instr is a base class for SP-instructions, which might perform conditional jump dependi...
Definition: sp_instr.h:865
sp_instr * m_cont_optdest
Definition: sp_instr.h:944
enum Instr_type type() override=0
Get the instruction type of this instruction.
sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_CSTRING expr_query, uint dest)
Definition: sp_instr.h:877
uint m_dest
Where we will go.
Definition: sp_instr.h:937
void opt_move(uint dst, List< sp_branch_instr > *ibp) override
Inform the instruction that it has been moved during optimization.
Definition: sp_instr.cc:1331
sp_lex_branch_instr(uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_CSTRING expr_query)
Definition: sp_instr.h:867
uint m_cont_dest
Where continue handlers will go.
Definition: sp_instr.h:940
bool is_invalid() const override
Definition: sp_instr.h:906
sp_instr * m_optdest
Definition: sp_instr.h:943
void set_destination(uint old_dest, uint new_dest) override
Update the destination; used by the SP-instruction-optimizer.
Definition: sp_instr.h:918
uint opt_mark(sp_head *sp, List< sp_instr > *leads) override
Mark this instruction as reachable during optimization and return the index to the next instruction.
Definition: sp_instr.cc:1307
LEX_CSTRING m_expr_query
SQL-query corresponding to the expression.
Definition: sp_instr.h:950
void adjust_sql_command(LEX *lex) override
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:930
LEX_CSTRING get_expr_query() const override
Definition: sp_instr.h:912
Item * m_expr_item
Expression item.
Definition: sp_instr.h:947
void invalidate() override
Invalidate the object.
Definition: sp_instr.h:908
void backpatch(uint dest) override
Update all instruction with the given label in the backpatch list to the specified instruction pointe...
Definition: sp_instr.h:924
uint get_cont_dest() const override
Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.
Definition: sp_instr.h:898
void set_cont_dest(uint cont_dest)
Definition: sp_instr.h:888
sp_lex_instr is a class providing the interface and base implementation for SP-instructions,...
Definition: sp_instr.h:252
bool execute_expression(THD *thd, uint *nextp)
Execute an expression (e.g an IF) that is not a complete SQL statement.
Definition: sp_instr.cc:319
bool reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables)
Prepare LEX and thread for execution of instruction, if requested open and lock LEX's tables,...
Definition: sp_instr.cc:388
~sp_lex_instr() override
Definition: sp_instr.h:264
const LEX * get_lex()
Definition: sp_instr.h:378
Table_ref ** m_lex_query_tables_own_last
The value m_lex->query_tables_own_last should be set to this when the statement enters/leaves prelock...
Definition: sp_instr.h:491
void set_lex(LEX *lex, bool is_lex_owner)
Set LEX-object.
Definition: sp_instr.cc:905
virtual LEX_CSTRING get_expr_query() const
Definition: sp_instr.h:427
virtual bool is_invalid() const =0
Table_ref * m_prelocking_tables
List of additional tables this statement needs to lock when it enters/leaves prelocked mode on its ow...
Definition: sp_instr.h:485
enum Instr_type type() override=0
Get the instruction type of this instruction.
LEX * m_lex
LEX-object.
Definition: sp_instr.h:452
virtual void get_query(String *sql_query) const
Return the query string, which can be passed to the parser.
Definition: sp_instr.cc:944
SQL_I_List< Item_trigger_field > * get_instr_trig_field_list() override
Definition: sp_instr.h:295
virtual void adjust_sql_command(LEX *)
Some expressions may be re-parsed as SELECT statements, but need to be adjusted to another SQL comman...
Definition: sp_instr.h:415
SQL_I_List< Item_trigger_field > m_trig_field_list
List of all the Item_trigger_field's of instruction.
Definition: sp_instr.h:496
bool validate_lex_and_execute_core(THD *thd, uint *nextp, bool open_tables)
Make a few attempts to execute the instruction.
Definition: sp_instr.cc:711
void free_lex()
Cleanup and destroy assigned LEX-object if needed.
Definition: sp_instr.cc:915
bool m_is_lex_owner
Indicates whether this sp_lex_instr instance is responsible for LEX-object deletion.
Definition: sp_instr.h:466
bool execute(THD *thd, uint *nextp) override
Execute this instruction.
Definition: sp_instr.h:354
virtual bool exec_core(THD *thd, uint *nextp)=0
Execute core function of instruction after all preparations (e.g.
bool m_first_execution
Indicates whether exec_core() has not been already called on the current LEX-object.
Definition: sp_instr.h:472
virtual bool on_after_expr_parsing(THD *thd)
Callback function which is called after the statement query string is successfully parsed,...
Definition: sp_instr.h:439
virtual void invalidate()=0
Invalidate the object.
virtual void cleanup_before_parsing(THD *thd)
Destroy items in the free list before re-parsing the statement query string (and thus,...
Definition: sp_instr.cc:931
sp_lex_instr(uint ip, sp_pcontext *ctx, LEX *lex, bool is_lex_owner)
Definition: sp_instr.h:254
MEM_ROOT m_lex_mem_root
Mem-root for storing the LEX-tree during reparse.
Definition: sp_instr.h:460
LEX * parse_statement(THD *thd, sp_head *sp)
Parse statement corresponding to this instruction and return a new LEX.
Definition: sp_instr.cc:573
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:252
sp_printable defines an interface which should be implemented if a class wants report some internal i...
Definition: sp_instr.h:67
virtual void print(const THD *thd, String *str)=0
virtual ~sp_printable()=default
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:49
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
bool open_tables(THD *thd, Table_ref **start, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy)
Open all tables in list.
Definition: sql_base.cc:5886
#define alloc_root_inited(A)
Definition: my_sys.h:802
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:217
Item * single_visible_field() const
Definition: sql_resolver.cc:4938
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
constexpr const LEX_CSTRING EMPTY_CSTR
Definition: lex_string.h:48
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.
#define MYF(v)
Definition: my_inttypes.h:97
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
@ SQLCOM_SELECT
Definition: my_sqlcommand.h:47
@ SQLCOM_END
Definition: my_sqlcommand.h:213
@ SQLCOM_SET_OPTION
Definition: my_sqlcommand.h:78
Common header for many mysys elements.
static int count
Definition: myisam_ftdump.cc:45
static char * query
Definition: myisam_ftdump.cc:47
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1078
Performance schema instrumentation interface.
File containing constants that can be used throughout the server.
constexpr const size_t MEM_ROOT_BLOCK_SIZE
Memory allocated when parsing a statement.
Definition: sql_const.h:129
Our own string classes, used pervasively throughout the executor.
#define STRING_WITH_LEN(X)
Definition: string_with_len.h:29
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3999
bool safe_to_cache_query
Whether this query will return the same answer every time, given unchanged data.
Definition: sql_lex.h:4414
Query_block * query_block
First query block.
Definition: sql_lex.h:4004
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
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Statement instrument information.
Definition: psi_statement_bits.h:133
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:44