Static Public Member Functions |
static sp_rcontext * | create (THD *thd, const sp_pcontext *root_parsing_ctx, Field *return_value_fld) |
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
Definition at line 51 of file sp_rcontext.h.
Member Function Documentation
Construct and properly initialize a new sp_rcontext instance. The static create-function is needed because we need a way to return an error from the constructor.
- Parameters
-
thd | Thread handle. |
root_parsing_ctx | Top-level parsing context for this stored program. |
return_value_fld | Field object to store the return value (for stored functions only). |
- Returns
- valid sp_rcontext object or NULL in case of OOM-error.
Definition at line 65 of file sp_rcontext.cc.
void sp_rcontext::exit_handler |
( |
sp_pcontext * |
target_scope | ) |
|
Handle return from SQL-handler.
- Parameters
-
target_scope | The BEGIN..END block, containing the target (next) instruction. |
Definition at line 230 of file sp_rcontext.cc.
uint sp_rcontext::get_last_handler_continue_ip |
( |
| ) |
const |
|
inline |
- Returns
- the continue instruction pointer if the last activated CONTINUE handler. This function must not be called for the EXIT handlers.
Definition at line 279 of file sp_rcontext.h.
bool sp_rcontext::handle_sql_condition |
( |
THD * |
thd, |
|
|
uint * |
ip, |
|
|
const sp_instr * |
cur_spi |
|
) |
| |
Handle current SQL condition (if any).
This is the public-interface function to handle SQL conditions in stored routines.
- Parameters
-
thd | Thread handle. |
ip[out] | Instruction pointer to the first handler instruction. |
cur_spi | Current SP instruction. |
- Return values
-
true | if an SQL-handler has been activated. That means, all of the following conditions are satisfied:
- the SP-instruction raised SQL-condition(s),
- and there is an SQL-handler to process at least one of those SQL-conditions,
- and that SQL-handler has been activated. Note, that the return value has nothing to do with "error flag" semantics.
|
false | otherwise. |
Definition at line 254 of file sp_rcontext.cc.
void sp_rcontext::pop_cursors |
( |
uint |
count | ) |
|
Pop and delete given number of sp_cursor instance from the cursor stack.
- Parameters
-
count | Number of cursors to pop & delete. |
Definition at line 185 of file sp_rcontext.cc.
void sp_rcontext::pop_handlers |
( |
sp_pcontext * |
current_scope | ) |
|
Pop and delete given number of sp_handler_entry instances from the handler call stack.
- Parameters
-
current_scope | The current BEGIN..END block. |
Definition at line 218 of file sp_rcontext.cc.
Create a new sp_cursor instance and push it to the cursor stack.
- Parameters
-
i | Cursor-push instruction. |
- Returns
- error flag.
- Return values
-
false | on success. |
true | on error. |
Definition at line 163 of file sp_rcontext.cc.
bool sp_rcontext::push_handler |
( |
sp_handler * |
handler, |
|
|
uint |
first_ip |
|
) |
| |
Create a new sp_handler_entry instance and push it to the handler call stack.
- Parameters
-
handler | SQL-handler object. |
first_ip | First instruction pointer of the handler. |
- Returns
- error flag.
- Return values
-
false | on success. |
true | on error. |
Definition at line 194 of file sp_rcontext.cc.
bool sp_rcontext::set_case_expr |
( |
THD * |
thd, |
|
|
int |
case_expr_id, |
|
|
Item ** |
case_expr_item_ptr |
|
) |
| |
Set CASE expression to the specified value.
- Parameters
-
thd | Thread handler. |
case_expr_id | The CASE expression identifier. |
case_expr_item | The CASE expression value |
- Returns
- error flag.
- Return values
-
false | on success. |
true | on error. |
- Note
- The idea is to reuse Item_cache for the expression of the one CASE statement. This optimization takes place when there is CASE statement inside of a loop. So, in other words, we will use the same object on each iteration instead of creating a new one for each iteration.
TODO Hypothetically, a type of CASE expression can be different for each iteration. For instance, this can happen if the expression contains a session variable (something like @VAR) and its type is changed from one iteration to another.
In order to cope with this problem, we check type each time, when we use already created object. If the type does not match, we re-create Item. This also can (should?) be optimized.
Definition at line 450 of file sp_rcontext.cc.
Member Data Documentation
Query_arena* sp_rcontext::callers_arena |
Arena used to (re) allocate items on. E.g. reallocate INOUT/OUT SP-variables when they don't fit into prealloced items. This is common situation with String items. It is used mainly in sp_eval_func_item().
Definition at line 192 of file sp_rcontext.h.
bool sp_rcontext::end_partial_result_set |
Flag to end an open result set before start executing an SQL-handler (if one is found). Otherwise the client will hang due to a violation of the client/server protocol.
Definition at line 197 of file sp_rcontext.h.
The documentation for this class was generated from the following files: