List of all members.
Classes |
class | Handler_call_frame |
class | sp_handler_entry |
class | Sql_condition_info |
Public Member Functions |
bool | set_variable (THD *thd, uint var_idx, Item **value) |
Item * | get_item (uint var_idx) const |
Item ** | get_item_addr (uint var_idx) const |
bool | set_return_value (THD *thd, Item **return_value_item) |
bool | is_return_value_set () const |
bool | push_handler (sp_handler *handler, uint first_ip) |
void | pop_handlers (sp_pcontext *current_scope) |
const Sql_condition_info * | raised_condition () const |
bool | handle_sql_condition (THD *thd, uint *ip, const sp_instr *cur_spi) |
void | exit_handler (sp_pcontext *target_scope) |
uint | get_last_handler_continue_ip () const |
bool | push_cursor (sp_instr_cpush *i) |
void | pop_cursors (uint count) |
void | pop_all_cursors () |
sp_cursor * | get_cursor (uint i) const |
bool | set_case_expr (THD *thd, int case_expr_id, Item **case_expr_item_ptr) |
Item * | get_case_expr (int case_expr_id) const |
Item ** | get_case_expr_addr (int case_expr_id) const |
Static Public Member Functions |
static sp_rcontext * | create (THD *thd, const sp_pcontext *root_parsing_ctx, Field *return_value_fld) |
Public Attributes |
Query_arena * | callers_arena |
bool | end_partial_result_set |
sp_head * | sp |
| The stored program for which this runtime context is created.
|
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.
Handle return from SQL-handler.
- Parameters:
-
target_scope | The BEGIN..END block, containing the target (next) instruction. |
- Returns:
- the continue instruction pointer if the last activated CONTINUE handler. This function must not be called for the EXIT handlers.
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. |
Pop and delete given number of sp_cursor instance from the cursor stack.
- Parameters:
-
count | Number of cursors to pop & delete. |
Pop and delete given number of sp_handler_entry instances from the handler call stack.
- Parameters:
-
current_scope | The current BEGIN..END block. |
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. |
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. |
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.
Member Data Documentation
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().
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.
The documentation for this class was generated from the following files: