MySQL  8.0.20
Source Code Documentation
sp_instr_stmt Class Reference

sp_instr_stmt represents almost all conventional SQL-statements, which are supported outside stored programs. More...

#include <sp_instr.h>

Inheritance diagram for sp_instr_stmt:
sp_lex_instr sp_instr sp_printable

Public Member Functions

 sp_instr_stmt (uint ip, LEX *lex, LEX_CSTRING query)
 
virtual bool execute (THD *thd, uint *nextp)
 Execute this instruction. More...
 
virtual void print (const THD *thd, String *str)
 
virtual bool exec_core (THD *thd, uint *nextp)
 Execute core function of instruction after all preparations (e.g. More...
 
virtual bool is_invalid () const
 
virtual void invalidate ()
 Invalidate the object. More...
 
virtual void get_query (String *sql_query) const
 Return the query string, which can be passed to the parser. More...
 
virtual bool on_after_expr_parsing (THD *)
 Callback function which is called after the statement query string is successfully parsed, and the thread context has not been switched to the outer context. More...
 
virtual PSI_statement_infoget_psi_info ()
 
- Public Member Functions inherited from sp_lex_instr
 sp_lex_instr (uint ip, sp_pcontext *ctx, LEX *lex, bool is_lex_owner)
 
virtual ~sp_lex_instr ()
 
bool validate_lex_and_execute_core (THD *thd, uint *nextp, bool open_tables)
 Make a few attempts to execute the instruction. More...
 
virtual SQL_I_List< Item_trigger_field > * get_instr_trig_field_list ()
 
- Public Member Functions inherited from sp_instr
 sp_instr (uint ip, sp_pcontext *ctx)
 
virtual ~sp_instr ()
 
uint get_ip () const
 
virtual uint get_cont_dest () const
 Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction. More...
 
sp_pcontextget_parsing_ctx () const
 
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. More...
 
virtual uint opt_shortcut_jump (sp_head *, sp_instr *start)
 Short-cut jumps to jumps during optimization. More...
 
virtual void opt_move (uint dst, List< sp_branch_instr > *ibp)
 Inform the instruction that it has been moved during optimization. More...
 
bool opt_is_marked () const
 
- Public Member Functions inherited from sp_printable
virtual ~sp_printable ()
 

Static Public Attributes

static PSI_statement_info psi_info = {0, "stmt", 0, PSI_DOCUMENT_ME}
 

Private Attributes

LEX_CSTRING m_query
 Complete query of the SQL-statement. More...
 
bool m_valid
 Specify if the stored LEX-object is up-to-date. More...
 

Additional Inherited Members

- Public Attributes inherited from sp_instr
Query_arena m_arena
 
- Protected Member Functions inherited from sp_lex_instr
virtual LEX_CSTRING get_expr_query () const
 
virtual void cleanup_before_parsing (THD *thd)
 Destroy items in the free list before re-parsing the statement query string (and thus, creating new items). More...
 
- Protected Member Functions inherited from sp_instr
void clear_da (THD *thd) const
 Clear diagnostics area. More...
 
- Protected Attributes inherited from sp_lex_instr
LEXm_lex
 LEX-object. More...
 
- Protected Attributes inherited from sp_instr
bool m_marked
 Show if this instruction is reachable within the SP (used by SP-optimizer). More...
 
uint m_ip
 Instruction pointer. More...
 
sp_pcontextm_parsing_ctx
 Instruction parsing context. More...
 

Detailed Description

sp_instr_stmt represents almost all conventional SQL-statements, which are supported outside stored programs.

SET-statements, which deal with SP-variable or NEW/OLD trigger pseudo-rows are not represented by this instruction.

Constructor & Destructor Documentation

◆ sp_instr_stmt()

sp_instr_stmt::sp_instr_stmt ( uint  ip,
LEX lex,
LEX_CSTRING  query 
)
inline

Member Function Documentation

◆ exec_core()

bool sp_instr_stmt::exec_core ( THD thd,
uint nextp 
)
virtual

Execute core function of instruction after all preparations (e.g.

setting of proper LEX, saving part of the thread context).

Parameters
thdThread context.
[out]nextpnext instruction pointer
Returns
Error flag.

Implements sp_lex_instr.

◆ execute()

bool sp_instr_stmt::execute ( THD thd,
uint nextp 
)
virtual

Execute this instruction.

Parameters
thdThread context
[out]nextpindex of the next instruction to execute. (For most instructions this will be the instruction following this one). Note that this parameter is undefined in case of errors, use get_cont_dest() to find the continuation instruction for CONTINUE error handlers.
Returns
Error status.

Reimplemented from sp_lex_instr.

◆ get_psi_info()

virtual PSI_statement_info* sp_instr_stmt::get_psi_info ( )
inlinevirtual

Implements sp_instr.

◆ get_query()

virtual void sp_instr_stmt::get_query ( String sql_query) const
inlinevirtual

Return the query string, which can be passed to the parser.

I.e. the operation should return a valid SQL-statement query string.

Parameters
[out]sql_querySQL-statement query string.

Reimplemented from sp_lex_instr.

◆ invalidate()

virtual void sp_instr_stmt::invalidate ( )
inlinevirtual

Invalidate the object.

Implements sp_lex_instr.

◆ is_invalid()

virtual bool sp_instr_stmt::is_invalid ( ) const
inlinevirtual
Return values
falseif the object (i.e. LEX-object) is valid and exec_core() can be just called.
trueif the object is not valid any longer, exec_core() can not be called. The original query string should be re-parsed and a new LEX-object should be used.

Implements sp_lex_instr.

◆ on_after_expr_parsing()

virtual bool sp_instr_stmt::on_after_expr_parsing ( THD thd)
inlinevirtual

Callback function which is called after the statement query string is successfully parsed, and the thread context has not been switched to the outer context.

The thread context contains new LEX-object corresponding to the parsed query string.

Parameters
thdThread context.
Returns
Error flag.

Reimplemented from sp_lex_instr.

◆ print()

void sp_instr_stmt::print ( const THD thd,
String str 
)
virtual

Implements sp_printable.

Member Data Documentation

◆ m_query

LEX_CSTRING sp_instr_stmt::m_query
private

Complete query of the SQL-statement.

◆ m_valid

bool sp_instr_stmt::m_valid
private

Specify if the stored LEX-object is up-to-date.

◆ psi_info

PSI_statement_info sp_instr_stmt::psi_info = {0, "stmt", 0, PSI_DOCUMENT_ME}
static

The documentation for this class was generated from the following files: