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

#include <sp_head.h>

Classes

struct  Backpatch_info

Public Member Functions

void start_parsing_sp_body (THD *thd, sp_head *sp)
void finish_parsing_sp_body (THD *thd)
bool is_parsing_sp_body () const
void process_new_sp_instr (THD *thd, sp_instr *i)
const char * pop_expr_start_ptr ()
void push_expr_start_ptr (const char *expr_start_ptr)
const char * get_current_stmt_start_ptr () const
void set_current_stmt_start_ptr (const char *stmt_start_ptr)
const char * get_option_start_ptr () const
void set_option_start_ptr (const char *option_start_ptr)
const char * get_parameter_start_ptr () const
void set_parameter_start_ptr (const char *ptr)
const char * get_parameter_end_ptr () const
void set_parameter_end_ptr (const char *ptr)
const char * get_body_start_ptr () const
void set_body_start_ptr (const char *ptr)
void push_lex (LEX *lex)
LEX * pop_lex ()
bool add_backpatch_entry (sp_branch_instr *i, sp_label *label)
void do_backpatch (sp_label *label, uint dest)
bool new_cont_backpatch ()
bool add_cont_backpatch_entry (sp_lex_branch_instr *i)
void do_cont_backpatch (uint dest)

Detailed Description

sp_parser_data provides a scope for attributes used at the SP-parsing stage only.

Definition at line 135 of file sp_head.h.

Member Function Documentation

bool sp_parser_data::add_backpatch_entry ( sp_branch_instr i,
sp_label label 
)

Put the instruction on the backpatch list, associated with the label.

Parameters
iThe SP-instruction.
labelThe label.
Returns
Error flag.

Definition at line 2004 of file sp_head.cc.

bool sp_parser_data::add_cont_backpatch_entry ( sp_lex_branch_instr i)

Add a SP-instruction to the current level.

Parameters
iThe SP-instruction.
Returns
Error flag.

Definition at line 2031 of file sp_head.cc.

void sp_parser_data::do_backpatch ( sp_label label,
uint  dest 
)

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

Parameters
labelThe label.
destThe instruction pointer.

Definition at line 2018 of file sp_head.cc.

void sp_parser_data::do_cont_backpatch ( uint  dest)

Backpatch (and pop) the current level to the given instruction pointer.

Parameters
destThe instruction pointer.

Definition at line 2038 of file sp_head.cc.

Here is the call graph for this function:

void sp_parser_data::finish_parsing_sp_body ( THD *  thd)
inline

Finish parsing of a stored program body statement.

This method switches THD::mem_root and THD::free_list back when SP-body parsing is completed.

Parameters
thdThread context.

Definition at line 179 of file sp_head.h.

Here is the call graph for this function:

bool sp_parser_data::is_parsing_sp_body ( ) const
inline
Return values
trueif SP-body statement is being parsed.
falseotherwise.

Definition at line 207 of file sp_head.h.

Here is the caller graph for this function:

bool sp_parser_data::new_cont_backpatch ( )
inline

Start a new backpatch level for the SP-instruction requiring continue destination. If the SP-instruction is NULL, the level is just increased.

Note
Only subclasses of sp_lex_branch_instr need backpatching of continue destinations (and no other classes do):

That's why the methods below accept sp_lex_branch_instr to make this relationship clear. And these two functions are the only places where set_cont_dest() is used, so set_cont_dest() is also a member of sp_lex_branch_instr.

Todo:
These functions should probably be declared in a separate interface class, but currently we try to minimize the sp_instr hierarchy.
Returns
false always.

Definition at line 346 of file sp_head.h.

const char* sp_parser_data::pop_expr_start_ptr ( )
inline

Retrieve expression start pointer in the query string.

This function is named 'pop' to highlight that it changes the internal state, and two subsequent calls may not return same value.

Note
It's true only in the debug mode, but this check is very useful in the parser to ensure we "pop" every "pushed" pointer, because we have lots of branches, and it's pretty easy to forget something somewhere.

Definition at line 226 of file sp_head.h.

void sp_parser_data::push_expr_start_ptr ( const char *  expr_start_ptr)
inline

Remember expression start pointer in the query string.

This function is named 'push' to highlight that the pointer must be retrieved (pop) later.

See Also
the note for pop_expr_start_ptr().

Definition at line 246 of file sp_head.h.

void sp_parser_data::start_parsing_sp_body ( THD *  thd,
sp_head sp 
)

Start parsing a stored program body statement.

This method switches THD::mem_root and THD::free_list in order to parse SP-body. The current values are kept to be restored after the body statement is parsed.

Parameters
thdThread context.
spStored Program being parsed.

Definition at line 1994 of file sp_head.cc.

Here is the call graph for this function:


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