MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sp_lex_branch_instr Class Reference

#include <sp_instr.h>

Inheritance diagram for sp_lex_branch_instr:
Collaboration diagram for sp_lex_branch_instr:

Public Member Functions

void set_cont_dest (uint cont_dest)
virtual uint opt_mark (sp_head *sp, List< sp_instr > *leads)
virtual void opt_move (uint dst, List< sp_branch_instr > *ibp)
virtual uint get_cont_dest () const
virtual bool is_invalid () const
virtual void invalidate ()
virtual LEX_STRING get_expr_query () const
virtual void set_destination (uint old_dest, uint new_dest)
virtual void backpatch (uint dest)
- Public Member Functions inherited from sp_lex_instr
 sp_lex_instr (uint ip, sp_pcontext *ctx, LEX *lex, bool is_lex_owner)
bool validate_lex_and_execute_core (THD *thd, uint *nextp, bool open_tables)
virtual bool execute (THD *thd, uint *nextp)
- Public Member Functions inherited from sp_instr
 sp_instr (uint ip, sp_pcontext *ctx)
uint get_ip () const
sp_pcontextget_parsing_ctx () const
virtual uint opt_shortcut_jump (sp_head *sp, sp_instr *start)
bool opt_is_marked () const
- Public Member Functions inherited from sp_printable
virtual void print (String *str)=0

Protected Member Functions

 sp_lex_branch_instr (uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_STRING expr_query)
 sp_lex_branch_instr (uint ip, sp_pcontext *ctx, LEX *lex, Item *expr_item, LEX_STRING expr_query, uint dest)
- Protected Member Functions inherited from sp_lex_instr
virtual bool exec_core (THD *thd, uint *nextp)=0
virtual void get_query (String *sql_query) const
virtual bool on_after_expr_parsing (THD *thd)
virtual void cleanup_before_parsing (THD *thd)

Protected Attributes

uint m_dest
 Where we will go.
uint m_cont_dest
 Where continue handlers will go.
sp_instrm_optdest
sp_instrm_cont_optdest
Itemm_expr_item
 Expression item.
LEX_STRING m_expr_query
 SQL-query corresponding to the expression.

Additional Inherited Members

- Static Public Member Functions inherited from Sql_alloc
static void * operator new (size_t size) throw ()
static void * operator new[] (size_t size) throw ()
static void * operator new[] (size_t size, MEM_ROOT *mem_root) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, size_t size)
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, size_t size)

Detailed Description

sp_lex_branch_instr is a base class for SP-instructions, which might perform conditional jump depending on the value of an SQL-expression.

Definition at line 727 of file sp_instr.h.

Member Function Documentation

virtual void sp_lex_branch_instr::backpatch ( uint  dest)
inlinevirtual

Update all instruction with the given label in the backpatch list to the specified instruction pointer.

Parameters
destdestination instruction pointer.

Implements sp_branch_instr.

Reimplemented in sp_instr_set_case_expr.

Definition at line 795 of file sp_instr.h.

virtual uint sp_lex_branch_instr::get_cont_dest ( ) const
inlinevirtual

Get the continuation destination (instruction pointer for the CONTINUE HANDLER) of this instruction.

Returns
the continuation destination

Reimplemented from sp_instr.

Definition at line 766 of file sp_instr.h.

Here is the caller graph for this function:

virtual LEX_STRING sp_lex_branch_instr::get_expr_query ( ) const
inlinevirtual
Returns
the expression query string. This string can not be passed directly to the parser as it is most likely not a valid SQL-statement.
Note
as it can be seen in the get_query() implementation, get_expr_query() might return EMPTY_STR. EMPTY_STR means that no query-expression is available. That happens when class provides different implementation of get_query(). Strictly speaking, this is a drawback of the current class hierarchy.

Reimplemented from sp_lex_instr.

Definition at line 779 of file sp_instr.h.

virtual void sp_lex_branch_instr::invalidate ( )
inlinevirtual

Invalidate the object.

Implements sp_lex_instr.

Reimplemented in sp_instr_jump_case_when.

Definition at line 776 of file sp_instr.h.

virtual bool sp_lex_branch_instr::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.

Definition at line 773 of file sp_instr.h.

uint sp_lex_branch_instr::opt_mark ( sp_head sp,
List< sp_instr > *  leads 
)
virtual

Mark this instruction as reachable during optimization and return the index to the next instruction. Jump instruction will add their destination to the leads list.

Reimplemented from sp_instr.

Reimplemented in sp_instr_set_case_expr.

Definition at line 1101 of file sp_instr.cc.

Here is the call graph for this function:

void sp_lex_branch_instr::opt_move ( uint  dst,
List< sp_branch_instr > *  ibp 
)
virtual

Inform the instruction that it has been moved during optimization. Most instructions will simply update its index, but jump instructions must also take care of their destination pointers. Forward jumps get pushed to the backpatch list 'ibp'.

Reimplemented from sp_instr.

Reimplemented in sp_instr_set_case_expr.

Definition at line 1129 of file sp_instr.cc.

virtual void sp_lex_branch_instr::set_destination ( uint  old_dest,
uint  new_dest 
)
inlinevirtual

Update the destination; used by the SP-instruction-optimizer.

Parameters
old_destcurrent (old) destination (instruction pointer).
new_destnew destination (instruction pointer).

Implements sp_branch_instr.

Reimplemented in sp_instr_set_case_expr.

Definition at line 786 of file sp_instr.h.


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