My Project
Classes | Public Member Functions
sp_parser_data Class Reference

#include <sp_head.h>

List of all members.

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.


Member Function Documentation

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

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

Add a SP-instruction to the current level.

Parameters:
iThe SP-instruction.
Returns:
Error flag.
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.
void sp_parser_data::do_cont_backpatch ( uint  dest)

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

Parameters:
destThe instruction pointer.
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.
bool sp_parser_data::is_parsing_sp_body ( ) const [inline]
Return values:
trueif SP-body statement is being parsed.
falseotherwise.

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.
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.
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().
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.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines