24#ifndef _SP_RCONTEXT_H_
25#define _SP_RCONTEXT_H_
90 Field *return_value_fld);
Element_type * array() const
Definition: sql_array.h:165
Stores status of the currently executed statement.
Definition: sql_error.h:269
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Definition: sql_list.h:434
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Definition: sql_class.h:343
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:623
Definition: query_result.h:174
Server_side_cursor – an interface for materialized implementation of cursors.
Definition: sql_cursor.h:51
Representation of a SQL condition.
Definition: sql_error.h:58
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4414
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:110
An interceptor of cursor result set used to implement FETCH <cname> INTO <varlist>.
Definition: sp_rcontext.h:405
bool send_eof(THD *) override
Definition: sp_rcontext.h:414
uint field_count
Definition: sp_rcontext.h:407
List< sp_variable > * spvar_list
Definition: sp_rcontext.h:406
void set_spvar_list(List< sp_variable > *vars)
Definition: sp_rcontext.h:412
bool send_data(THD *thd, const mem_root_deque< Item * > &items) override
Definition: sp_rcontext.cc:534
uint get_field_count()
Definition: sp_rcontext.h:411
bool prepare(THD *thd, const mem_root_deque< Item * > &list, Query_expression *u) override
Perform preparation specific to the query expression or DML statement.
Definition: sp_rcontext.cc:524
Query_fetch_into_spvars()
Definition: sp_rcontext.h:410
Definition: sp_rcontext.h:399
sp_instr_cpush * m_push_instr
Definition: sp_rcontext.h:440
bool is_open() const
Definition: sp_rcontext.h:430
bool open(THD *thd)
Open an SP cursor.
Definition: sp_rcontext.cc:456
bool fetch(List< sp_variable > *vars)
Definition: sp_rcontext.cc:485
sp_instr_cpush * get_push_instr()
Definition: sp_rcontext.h:434
bool close()
Definition: sp_rcontext.cc:472
virtual ~sp_cursor()
Definition: sp_rcontext.h:424
sp_cursor(sp_instr_cpush *i)
Definition: sp_rcontext.h:421
Server_side_cursor * m_server_side_cursor
Definition: sp_rcontext.h:439
void destroy()
Definition: sp_rcontext.cc:483
Query_fetch_into_spvars m_result
Definition: sp_rcontext.h:437
This class represents 'DECLARE HANDLER' statement.
Definition: sp_pcontext.h:193
sp_head represents one instance of a stored program.
Definition: sp_head.h:380
sp_instr_cpush corresponds to DECLARE CURSOR, implements DECLARE CURSOR and OPEN.
Definition: sp_instr.h:1230
Base class for every SP-instruction.
Definition: sp_instr.h:105
The class represents parse-time context, which keeps track of declared variables/parameters,...
Definition: sp_pcontext.h:252
This class represents a call frame of SQL-handler (one invocation of a handler).
Definition: sp_rcontext.h:125
Handler_call_frame(const sp_handler *_handler, Sql_condition *_sql_condition, uint _continue_ip)
The constructor.
Definition: sp_rcontext.h:146
Diagnostics_area handler_da
The Diagnostics Area which will be pushed when the handler activates and popped when the handler comp...
Definition: sp_rcontext.h:139
uint continue_ip
Continue-instruction-pointer for CONTINUE-handlers.
Definition: sp_rcontext.h:135
Sql_condition * sql_condition
SQL-condition, triggered handler activation.
Definition: sp_rcontext.h:131
const sp_handler * handler
Handler definition (from parsing context).
Definition: sp_rcontext.h:128
This is an auxiliary class to store entering instruction pointer for an SQL-handler.
Definition: sp_rcontext.h:105
uint first_ip
Instruction pointer to the first instruction.
Definition: sp_rcontext.h:111
sp_handler_entry(const sp_handler *_handler, uint _first_ip)
The constructor.
Definition: sp_rcontext.h:117
const sp_handler * handler
Handler definition (from parsing context).
Definition: sp_rcontext.h:108
Definition: sp_rcontext.h:77
Query_arena * callers_arena
Arena used to (re) allocate items on.
Definition: sp_rcontext.h:158
uint get_last_handler_continue_ip() const
Definition: sp_rcontext.h:243
bool m_return_value_set
Indicates whether the return value (in m_return_value_fld) has been set during execution.
Definition: sp_rcontext.h:372
sp_cursor * get_cursor(uint i) const
Definition: sp_rcontext.h:270
bool set_variable(THD *thd, uint var_idx, Item **value)
Definition: sp_rcontext.h:172
void pop_handlers(sp_pcontext *current_scope)
Pop and delete given number of sp_handler_entry instances from the handler call stack.
Definition: sp_rcontext.cc:204
bool init_var_items(THD *thd)
Create and initialize an Item-adapter (Item_field) for each SP-var field.
Definition: sp_rcontext.cc:132
Item * get_case_expr(int case_expr_id) const
Definition: sp_rcontext.h:303
Bounds_checked_array< Item * > m_var_items
Collection of Item_field proxies, each of them points to the corresponding field in m_var_table.
Definition: sp_rcontext.h:364
bool init_var_table(THD *thd)
Create and initialize a table to store SP-variables.
Definition: sp_rcontext.cc:114
~sp_rcontext()
Definition: sp_rcontext.cc:67
void pop_all_cursors()
Definition: sp_rcontext.h:268
Prealloced_array< sp_handler_entry *, 16 > m_visible_handlers
Stack of visible handlers.
Definition: sp_rcontext.h:378
bool set_return_value(THD *thd, Item **return_value_item)
Definition: sp_rcontext.cc:148
void pop_handler_frame(THD *thd)
Pop the Handler_call_frame on top of the stack of active handlers.
Definition: sp_rcontext.cc:215
bool handle_sql_condition(THD *thd, uint *ip, const sp_instr *cur_spi)
Handle current SQL condition (if any).
Definition: sp_rcontext.cc:258
bool push_handler(sp_handler *handler, uint first_ip)
Create a new sp_handler_entry instance and push it to the handler call stack.
Definition: sp_rcontext.cc:185
sp_head * sp
The stored program for which this runtime context is created.
Definition: sp_rcontext.h:166
Bounds_checked_array< Item_cache * > m_case_expr_holders
Array of CASE expression holders.
Definition: sp_rcontext.h:390
void exit_handler(THD *thd, sp_pcontext *target_scope)
Handle return from SQL-handler.
Definition: sp_rcontext.cc:229
Bounds_checked_array< sp_cursor * > m_cstack
Stack of cursors.
Definition: sp_rcontext.h:384
void operator=(sp_rcontext &)
Handler_call_frame * current_handler_frame() const
Get the Handler_call_frame representing the currently active handler.
Definition: sp_rcontext.h:208
sp_rcontext(const sp_pcontext *root_parsing_ctx, Field *return_value_fld, bool in_sub_stmt)
Definition: sp_rcontext.cc:55
bool alloc_arrays(THD *thd)
Internal function to allocate memory for arrays.
Definition: sp_rcontext.cc:97
TABLE * m_var_table
Virtual table for storing SP-variables.
Definition: sp_rcontext.h:360
Item ** get_item_addr(uint var_idx) const
Definition: sp_rcontext.h:178
void pop_cursors(uint count)
Pop and delete given number of sp_cursor instance from the cursor stack.
Definition: sp_rcontext.cc:175
uint m_ccount
Current number of cursors in m_cstack.
Definition: sp_rcontext.h:387
Field * m_return_value_fld
This is a pointer to a field, which should contain return value for stored functions (only).
Definition: sp_rcontext.h:368
sp_rcontext(const sp_rcontext &)
Item * get_item(uint var_idx) const
Definition: sp_rcontext.h:176
Item ** get_case_expr_addr(int case_expr_id) const
Definition: sp_rcontext.h:307
bool end_partial_result_set
Flag to end an open result set before start executing an SQL-handler (if one is found).
Definition: sp_rcontext.h:163
bool m_in_sub_stmt
Flag to tell if the runtime context is created for a sub-statement.
Definition: sp_rcontext.h:375
bool is_return_value_set() const
Definition: sp_rcontext.h:184
Item_cache * create_case_expr_holder(THD *thd, const Item *item) const
Create an instance of appropriate Item_cache class depending on the specified type in the callers are...
Definition: sp_rcontext.cc:413
bool push_cursor(sp_instr_cpush *i)
Create a new sp_cursor instance and push it to the cursor stack.
Definition: sp_rcontext.cc:156
bool set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr)
Set CASE expression to the specified value.
Definition: sp_rcontext.cc:427
Prealloced_array< Handler_call_frame *, 16 > m_activated_handlers
Stack of caught SQL conditions.
Definition: sp_rcontext.h:381
const sp_pcontext * m_root_parsing_ctx
Top-level (root) parsing context for this runtime context.
Definition: sp_rcontext.h:357
static sp_rcontext * create(THD *thd, const sp_pcontext *root_parsing_ctx, Field *return_value_fld)
Construct and properly initialize a new sp_rcontext instance.
Definition: sp_rcontext.cc:81
This class represents a stored program variable or a parameter (also referenced as 'SP-variable').
Definition: sp_pcontext.h:49
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
Some integer typedefs for easier portability.
static int count
Definition: myisam_ftdump.cc:43
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2878
Field ** field
Definition: table.h:1438
#define NULL
Definition: types.h:55
unsigned int uint
Definition: uca9-dump.cc:75