/
usr
/
include
/
mysql
/
server
/
private
/
/usr/include/mysql/server/private
mkdir
upload
Name
Size
Mode
Actions
atomic/
-
0755
rm
data/
-
0755
rm
providers/
-
0755
rm
aligned.h
1136
0644
edit
dl
rm
aria_backup.h
1787
0644
edit
dl
rm
assume_aligned.h
2350
0644
edit
dl
rm
authors.h
10141
0644
edit
dl
rm
backup.h
1703
0644
edit
dl
rm
bounded_queue.h
6093
0644
edit
dl
rm
client_settings.h
1935
0644
edit
dl
rm
compat56.h
2280
0644
edit
dl
rm
config.h
14543
0644
edit
dl
rm
contributors.h
4878
0644
edit
dl
rm
create_options.h
4193
0644
edit
dl
rm
create_tmp_table.h
2808
0644
edit
dl
rm
cset_narrowing.h
3968
0644
edit
dl
rm
custom_conf.h
1082
0644
edit
dl
rm
datadict.h
1700
0644
edit
dl
rm
ddl_log.h
12807
0644
edit
dl
rm
debug.h
1234
0644
edit
dl
rm
debug_sync.h
2046
0644
edit
dl
rm
derived_handler.h
2379
0644
edit
dl
rm
derror.h
980
0644
edit
dl
rm
des_key_file.h
1236
0644
edit
dl
rm
discover.h
1570
0644
edit
dl
rm
dur_prop.h
1082
0644
edit
dl
rm
embedded_priv.h
1733
0644
edit
dl
rm
events.h
4704
0644
edit
dl
rm
event_data_objects.h
4187
0644
edit
dl
rm
event_db_repository.h
3648
0644
edit
dl
rm
event_parse_data.h
2899
0644
edit
dl
rm
event_queue.h
3438
0644
edit
dl
rm
event_scheduler.h
3290
0644
edit
dl
rm
field.h
222336
0644
edit
dl
rm
field_comp.h
1174
0644
edit
dl
rm
filesort.h
7283
0644
edit
dl
rm
filesort_utils.h
8195
0644
edit
dl
rm
ft_global.h
3113
0644
edit
dl
rm
gcalc_slicescan.h
17272
0644
edit
dl
rm
gcalc_tools.h
11900
0644
edit
dl
rm
grant.h
2758
0644
edit
dl
rm
group_by_handler.h
3534
0644
edit
dl
rm
gstream.h
2437
0644
edit
dl
rm
handler.h
199730
0644
edit
dl
rm
handle_connections_win.h
884
0644
edit
dl
rm
hash.h
4452
0644
edit
dl
rm
hash_filo.h
5688
0644
edit
dl
rm
ha_handler_stats.h
2335
0644
edit
dl
rm
ha_partition.h
64696
0644
edit
dl
rm
ha_sequence.h
6245
0644
edit
dl
rm
heap.h
9480
0644
edit
dl
rm
hostname.h
5419
0644
edit
dl
rm
ilist.h
7237
0644
edit
dl
rm
init.h
852
0644
edit
dl
rm
innodb_priv.h
1319
0644
edit
dl
rm
item.h
283188
0644
edit
dl
rm
item_cmpfunc.h
135071
0644
edit
dl
rm
item_create.h
11508
0644
edit
dl
rm
item_func.h
138638
0644
edit
dl
rm
item_geofunc.h
39612
0644
edit
dl
rm
item_jsonfunc.h
25264
0644
edit
dl
rm
item_row.h
5229
0644
edit
dl
rm
item_strfunc.h
74995
0644
edit
dl
rm
item_subselect.h
59028
0644
edit
dl
rm
item_sum.h
72695
0644
edit
dl
rm
item_timefunc.h
65896
0644
edit
dl
rm
item_vers.h
4413
0644
edit
dl
rm
item_windowfunc.h
34556
0644
edit
dl
rm
item_xmlfunc.h
4650
0644
edit
dl
rm
json_table.h
9667
0644
edit
dl
rm
key.h
2132
0644
edit
dl
rm
keycaches.h
1995
0644
edit
dl
rm
lex.h
29840
0644
edit
dl
rm
lex_charset.h
24313
0644
edit
dl
rm
lex_hash.h
143108
0644
edit
dl
rm
lex_ident.h
2122
0644
edit
dl
rm
lex_string.h
4077
0644
edit
dl
rm
lex_symbol.h
1323
0644
edit
dl
rm
lex_token.h
42641
0644
edit
dl
rm
lf.h
6462
0644
edit
dl
rm
lock.h
2220
0644
edit
dl
rm
log.h
46370
0644
edit
dl
rm
log_event.h
189106
0644
edit
dl
rm
log_event_data_type.h
1890
0644
edit
dl
rm
log_event_old.h
19830
0644
edit
dl
rm
log_slow.h
2442
0644
edit
dl
rm
maria.h
5872
0644
edit
dl
rm
mariadb.h
1277
0644
edit
dl
rm
mdl.h
38503
0644
edit
dl
rm
mem_root_array.h
7106
0644
edit
dl
rm
message.h
1195
0644
edit
dl
rm
multi_range_read.h
23179
0644
edit
dl
rm
myisam.h
17506
0644
edit
dl
rm
myisamchk.h
4734
0644
edit
dl
rm
myisammrg.h
4897
0644
edit
dl
rm
myisampack.h
14929
0644
edit
dl
rm
mysqld.h
41063
0644
edit
dl
rm
mysqld_default_groups.h
204
0644
edit
dl
rm
mysqld_suffix.h
1201
0644
edit
dl
rm
mysys_err.h
3022
0644
edit
dl
rm
my_alarm.h
2429
0644
edit
dl
rm
my_apc.h
4747
0644
edit
dl
rm
my_atomic.h
7281
0644
edit
dl
rm
my_atomic_wrapper.h
3051
0644
edit
dl
rm
my_base.h
27656
0644
edit
dl
rm
my_bit.h
6196
0644
edit
dl
rm
my_bitmap.h
5502
0644
edit
dl
rm
my_check_opt.h
2618
0644
edit
dl
rm
my_compare.h
11194
0644
edit
dl
rm
my_counter.h
1721
0644
edit
dl
rm
my_cpu.h
4855
0644
edit
dl
rm
my_crypt.h
904
0644
edit
dl
rm
my_decimal.h
14489
0644
edit
dl
rm
my_default.h
1880
0644
edit
dl
rm
my_handler_errors.h
4882
0644
edit
dl
rm
my_json_writer.h
18573
0644
edit
dl
rm
my_libwrap.h
1183
0644
edit
dl
rm
my_md5.h
1486
0644
edit
dl
rm
my_minidump.h
848
0644
edit
dl
rm
my_nosys.h
1438
0644
edit
dl
rm
my_rdtsc.h
10119
0644
edit
dl
rm
my_rnd.h
1014
0644
edit
dl
rm
my_service_manager.h
2087
0644
edit
dl
rm
my_stacktrace.h
3215
0644
edit
dl
rm
my_stack_alloc.h
6493
0644
edit
dl
rm
my_time.h
10414
0644
edit
dl
rm
my_tree.h
3991
0644
edit
dl
rm
my_uctype.h
69528
0644
edit
dl
rm
my_user.h
1126
0644
edit
dl
rm
my_virtual_mem.h
1127
0644
edit
dl
rm
opt_histogram_json.h
4638
0644
edit
dl
rm
opt_range.h
65903
0644
edit
dl
rm
opt_subselect.h
14545
0644
edit
dl
rm
opt_trace.h
8494
0644
edit
dl
rm
opt_trace_context.h
3291
0644
edit
dl
rm
parse_file.h
4387
0644
edit
dl
rm
partition_element.h
5428
0644
edit
dl
rm
partition_info.h
19864
0644
edit
dl
rm
password.h
1170
0644
edit
dl
rm
pfs_file_provider.h
3153
0644
edit
dl
rm
pfs_idle_provider.h
1385
0644
edit
dl
rm
pfs_memory_provider.h
1626
0644
edit
dl
rm
pfs_metadata_provider.h
1898
0644
edit
dl
rm
pfs_socket_provider.h
2258
0644
edit
dl
rm
pfs_stage_provider.h
1556
0644
edit
dl
rm
pfs_statement_provider.h
4347
0644
edit
dl
rm
pfs_table_provider.h
2625
0644
edit
dl
rm
pfs_thread_provider.h
5560
0644
edit
dl
rm
pfs_transaction_provider.h
2846
0644
edit
dl
rm
privilege.h
28889
0644
edit
dl
rm
probes_mysql.h
973
0644
edit
dl
rm
probes_mysql_nodtrace.h
6087
0644
edit
dl
rm
procedure.h
6819
0644
edit
dl
rm
protocol.h
12537
0644
edit
dl
rm
proxy_protocol.h
548
0644
edit
dl
rm
queues.h
3477
0644
edit
dl
rm
records.h
3147
0644
edit
dl
rm
replication.h
16130
0644
edit
dl
rm
repl_failsafe.h
1585
0644
edit
dl
rm
rijndael.h
1711
0644
edit
dl
rm
rowid_filter.h
15474
0644
edit
dl
rm
rpl_constants.h
3357
0644
edit
dl
rm
rpl_filter.h
4774
0644
edit
dl
rm
rpl_gtid.h
29939
0644
edit
dl
rm
rpl_injector.h
9621
0644
edit
dl
rm
rpl_mi.h
16638
0644
edit
dl
rm
rpl_parallel.h
18228
0644
edit
dl
rm
rpl_record.h
1585
0644
edit
dl
rm
rpl_record_old.h
1407
0644
edit
dl
rm
rpl_reporting.h
3713
0644
edit
dl
rm
rpl_rli.h
36070
0644
edit
dl
rm
rpl_tblmap.h
3177
0644
edit
dl
rm
rpl_utility.h
9630
0644
edit
dl
rm
scheduler.h
3199
0644
edit
dl
rm
scope.h
4393
0644
edit
dl
rm
select_handler.h
2228
0644
edit
dl
rm
semisync.h
2287
0644
edit
dl
rm
semisync_master.h
25766
0644
edit
dl
rm
semisync_master_ack_receiver.h
8709
0644
edit
dl
rm
semisync_slave.h
3736
0644
edit
dl
rm
service_versions.h
2285
0644
edit
dl
rm
session_tracker.h
14275
0644
edit
dl
rm
set_var.h
16551
0644
edit
dl
rm
slave.h
12275
0644
edit
dl
rm
socketpair.h
842
0644
edit
dl
rm
source_revision.h
67
0644
edit
dl
rm
sp.h
22588
0644
edit
dl
rm
span.h
3931
0644
edit
dl
rm
spatial.h
22698
0644
edit
dl
rm
sp_cache.h
2037
0644
edit
dl
rm
sp_head.h
64917
0644
edit
dl
rm
sp_pcontext.h
24893
0644
edit
dl
rm
sp_rcontext.h
14441
0644
edit
dl
rm
sql_acl.h
14167
0644
edit
dl
rm
sql_admin.h
2915
0644
edit
dl
rm
sql_alloc.h
1732
0644
edit
dl
rm
sql_alter.h
15395
0644
edit
dl
rm
sql_analyse.h
11125
0644
edit
dl
rm
sql_analyze_stmt.h
12683
0644
edit
dl
rm
sql_array.h
6858
0644
edit
dl
rm
sql_audit.h
14162
0644
edit
dl
rm
sql_base.h
26041
0644
edit
dl
rm
sql_basic_types.h
9523
0644
edit
dl
rm
sql_binlog.h
895
0644
edit
dl
rm
sql_bitmap.h
7842
0644
edit
dl
rm
sql_bootstrap.h
1812
0644
edit
dl
rm
sql_cache.h
21676
0644
edit
dl
rm
sql_callback.h
1542
0644
edit
dl
rm
sql_class.h
271120
0644
edit
dl
rm
sql_cmd.h
5962
0644
edit
dl
rm
sql_command.h
4800
0644
edit
dl
rm
sql_connect.h
4087
0644
edit
dl
rm
sql_const.h
11415
0644
edit
dl
rm
sql_crypt.h
1437
0644
edit
dl
rm
sql_cte.h
16494
0644
edit
dl
rm
sql_cursor.h
4239
0644
edit
dl
rm
sql_db.h
2438
0644
edit
dl
rm
sql_debug.h
5646
0644
edit
dl
rm
sql_delete.h
1343
0644
edit
dl
rm
sql_derived.h
1289
0644
edit
dl
rm
sql_digest.h
3819
0644
edit
dl
rm
sql_digest_stream.h
1567
0644
edit
dl
rm
sql_do.h
954
0644
edit
dl
rm
sql_error.h
39843
0644
edit
dl
rm
sql_explain.h
30319
0644
edit
dl
rm
sql_expression_cache.h
4359
0644
edit
dl
rm
sql_get_diagnostics.h
7883
0644
edit
dl
rm
sql_handler.h
2910
0644
edit
dl
rm
sql_help.h
995
0644
edit
dl
rm
sql_hset.h
3401
0644
edit
dl
rm
sql_insert.h
5173
0644
edit
dl
rm
sql_i_s.h
8487
0644
edit
dl
rm
sql_join_cache.h
48659
0644
edit
dl
rm
sql_lex.h
174693
0644
edit
dl
rm
sql_lifo_buffer.h
9676
0644
edit
dl
rm
sql_limit.h
3187
0644
edit
dl
rm
sql_list.h
22391
0644
edit
dl
rm
sql_load.h
1276
0644
edit
dl
rm
sql_locale.h
2701
0644
edit
dl
rm
sql_manager.h
960
0644
edit
dl
rm
sql_mode.h
6735
0644
edit
dl
rm
sql_parse.h
8970
0644
edit
dl
rm
sql_partition.h
12674
0644
edit
dl
rm
sql_partition_admin.h
5940
0644
edit
dl
rm
sql_plist.h
7711
0644
edit
dl
rm
sql_plugin.h
7577
0644
edit
dl
rm
sql_plugin_compat.h
2237
0644
edit
dl
rm
sql_prepare.h
11409
0644
edit
dl
rm
sql_priv.h
18474
0644
edit
dl
rm
sql_profile.h
7816
0644
edit
dl
rm
sql_reload.h
1036
0644
edit
dl
rm
sql_rename.h
982
0644
edit
dl
rm
sql_repl.h
3045
0644
edit
dl
rm
sql_schema.h
3303
0644
edit
dl
rm
sql_select.h
89743
0644
edit
dl
rm
sql_sequence.h
5177
0644
edit
dl
rm
sql_servers.h
1777
0644
edit
dl
rm
sql_show.h
9830
0644
edit
dl
rm
sql_signal.h
3362
0644
edit
dl
rm
sql_sort.h
21964
0644
edit
dl
rm
sql_statistics.h
16494
0644
edit
dl
rm
sql_string.h
39009
0644
edit
dl
rm
sql_table.h
9752
0644
edit
dl
rm
sql_test.h
1589
0644
edit
dl
rm
sql_time.h
8374
0644
edit
dl
rm
sql_trigger.h
12332
0644
edit
dl
rm
sql_truncate.h
2079
0644
edit
dl
rm
sql_tvc.h
2418
0644
edit
dl
rm
sql_type.h
296072
0644
edit
dl
rm
sql_type_fixedbin.h
65578
0644
edit
dl
rm
sql_type_fixedbin_storage.h
5467
0644
edit
dl
rm
sql_type_geom.h
19039
0644
edit
dl
rm
sql_type_int.h
10001
0644
edit
dl
rm
sql_type_json.h
6155
0644
edit
dl
rm
sql_type_real.h
1257
0644
edit
dl
rm
sql_type_string.h
1629
0644
edit
dl
rm
sql_udf.h
4850
0644
edit
dl
rm
sql_union.h
1068
0644
edit
dl
rm
sql_update.h
1923
0644
edit
dl
rm
sql_view.h
2470
0644
edit
dl
rm
sql_window.h
6814
0644
edit
dl
rm
ssl_compat.h
3380
0644
edit
dl
rm
strfunc.h
2275
0644
edit
dl
rm
structs.h
29530
0644
edit
dl
rm
sys_vars_shared.h
2729
0644
edit
dl
rm
table.h
118414
0644
edit
dl
rm
table_cache.h
4232
0644
edit
dl
rm
threadpool.h
4810
0644
edit
dl
rm
threadpool_generic.h
3969
0644
edit
dl
rm
threadpool_winsockets.h
2290
0644
edit
dl
rm
thread_cache.h
5905
0644
edit
dl
rm
thr_alarm.h
2932
0644
edit
dl
rm
thr_lock.h
7350
0644
edit
dl
rm
thr_malloc.h
1202
0644
edit
dl
rm
thr_timer.h
1563
0644
edit
dl
rm
transaction.h
1466
0644
edit
dl
rm
tzfile.h
5014
0644
edit
dl
rm
tztime.h
3397
0644
edit
dl
rm
t_ctype.h
5639
0644
edit
dl
rm
uniques.h
4217
0644
edit
dl
rm
unireg.h
7722
0644
edit
dl
rm
vers_string.h
2543
0644
edit
dl
rm
violite.h
10086
0644
edit
dl
rm
waiting_threads.h
4532
0644
edit
dl
rm
welcome_copyright_notice.h
1218
0644
edit
dl
rm
winservice.h
6019
0644
edit
dl
rm
win_tzname_data.h
6506
0644
edit
dl
rm
wqueue.h
1565
0644
edit
dl
rm
wsrep.h
3308
0644
edit
dl
rm
wsrep_allowlist_service.h
1035
0644
edit
dl
rm
wsrep_applier.h
2703
0644
edit
dl
rm
wsrep_binlog.h
3551
0644
edit
dl
rm
wsrep_client_service.h
2560
0644
edit
dl
rm
wsrep_client_state.h
1566
0644
edit
dl
rm
wsrep_condition_variable.h
1484
0644
edit
dl
rm
wsrep_high_priority_service.h
4912
0644
edit
dl
rm
wsrep_mutex.h
1239
0644
edit
dl
rm
wsrep_mysqld.h
21524
0644
edit
dl
rm
wsrep_mysqld_c.h
1227
0644
edit
dl
rm
wsrep_on.h
1718
0644
edit
dl
rm
wsrep_priv.h
1634
0644
edit
dl
rm
wsrep_schema.h
5608
0644
edit
dl
rm
wsrep_server_service.h
3631
0644
edit
dl
rm
wsrep_server_state.h
2529
0644
edit
dl
rm
wsrep_sst.h
3951
0644
edit
dl
rm
wsrep_status.h
1816
0644
edit
dl
rm
wsrep_storage_service.h
1809
0644
edit
dl
rm
wsrep_thd.h
11487
0644
edit
dl
rm
wsrep_trans_observer.h
18174
0644
edit
dl
rm
wsrep_types.h
1110
0644
edit
dl
rm
wsrep_utils.h
9807
0644
edit
dl
rm
wsrep_var.h
4491
0644
edit
dl
rm
wsrep_xid.h
1549
0644
edit
dl
rm
xa.h
1845
0644
edit
dl
rm
Edit:
/usr/include/mysql/server/private/sp_rcontext.h
(14441B)
/* -*- C++ -*- */ /* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #ifndef _SP_RCONTEXT_H_ #define _SP_RCONTEXT_H_ #ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif #include "sql_class.h" // select_result_interceptor #include "sp_pcontext.h" // sp_condition_value /////////////////////////////////////////////////////////////////////////// // sp_rcontext declaration. /////////////////////////////////////////////////////////////////////////// class sp_cursor; class sp_lex_keeper; class sp_instr_cpush; class sp_instr_hpush_jump; class Query_arena; class sp_head; class Item_cache; class Virtual_tmp_table; /* This class is a runtime context of a Stored Routine. It is used in an execution and is intended to contain all dynamic objects (i.e. objects, which can be changed during execution), such as: - stored routine variables; - cursors; - handlers; Runtime context is used with sp_head class. sp_head class is intended to contain all static things, related to the stored routines (code, for example). sp_head instance creates runtime context for the execution of a stored routine. There is a parsing context (an instance of sp_pcontext class), which is used on parsing stage. However, now it contains some necessary for an execution things, such as definition of used stored routine variables. That's why runtime context needs a reference to the parsing context. */ class sp_rcontext : public Sql_alloc { public: /// 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. /// /// @param thd Thread handle. /// @param root_parsing_ctx Top-level parsing context for this stored program. /// @param return_value_fld Field object to store the return value /// (for stored functions only). /// /// @return valid sp_rcontext object or NULL in case of OOM-error. static sp_rcontext *create(THD *thd, const sp_head *owner, const sp_pcontext *root_parsing_ctx, Field *return_value_fld, Row_definition_list &defs); ~sp_rcontext(); private: sp_rcontext(const sp_head *owner, const sp_pcontext *root_parsing_ctx, Field *return_value_fld, bool in_sub_stmt); // Prevent use of copying constructor and operator. sp_rcontext(const sp_rcontext &); void operator=(sp_rcontext &); public: /// This class stores basic information about SQL-condition, such as: /// - SQL error code; /// - error level; /// - SQLSTATE; /// - text message. /// /// It's used to organize runtime SQL-handler call stack. /// /// Standard Sql_condition class can not be used, because we don't always have /// an Sql_condition object for an SQL-condition in Diagnostics_area. /// /// Eventually, this class should be moved to sql_error.h, and be a part of /// standard SQL-condition processing (Diagnostics_area should contain an /// object for active SQL-condition, not just information stored in DA's /// fields). class Sql_condition_info : public Sql_alloc, public Sql_condition_identity { public: /// Text message. char *message; /** Row number where the condition has happened */ ulong m_row_number; /// The constructor. /// /// @param _sql_condition The SQL condition. /// @param arena Query arena for SP Sql_condition_info(const Sql_condition *_sql_condition, Query_arena *arena) :Sql_condition_identity(*_sql_condition) { message= strdup_root(arena->mem_root, _sql_condition->get_message_text()); m_row_number= _sql_condition->m_row_number; } }; private: /// This class represents a call frame of SQL-handler (one invocation of a /// handler). Basically, it's needed to store continue instruction pointer for /// CONTINUE SQL-handlers. class Handler_call_frame : public Sql_alloc { public: /// SQL-condition, triggered handler activation. const Sql_condition_info *sql_condition; /// Continue-instruction-pointer for CONTINUE-handlers. /// The attribute contains 0 for EXIT-handlers. uint continue_ip; /// The constructor. /// /// @param _sql_condition SQL-condition, triggered handler activation. /// @param _continue_ip Continue instruction pointer. Handler_call_frame(const Sql_condition_info *_sql_condition, uint _continue_ip) :sql_condition(_sql_condition), continue_ip(_continue_ip) { } }; public: /// 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(). Query_arena *callers_arena; /// 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. bool end_partial_result_set; bool pause_state; bool quit_func; uint instr_ptr; /// The stored program for which this runtime context is created. Used for /// checking if correct runtime context is used for variable handling, /// and to access the package run-time context. /// Also used by slow log. const sp_head *m_sp; ///////////////////////////////////////////////////////////////////////// // SP-variables. ///////////////////////////////////////////////////////////////////////// uint argument_count() const { return m_root_parsing_ctx->context_var_count(); } int set_variable(THD *thd, uint var_idx, Item **value); int set_variable_row_field(THD *thd, uint var_idx, uint field_idx, Item **value); int set_variable_row_field_by_name(THD *thd, uint var_idx, const LEX_CSTRING &field_name, Item **value); int set_variable_row(THD *thd, uint var_idx, List<Item> &items); int set_parameter(THD *thd, uint var_idx, Item **value) { DBUG_ASSERT(var_idx < argument_count()); return set_variable(thd, var_idx, value); } Item_field *get_variable(uint var_idx) const { return m_var_items[var_idx]; } Item **get_variable_addr(uint var_idx) const { return ((Item **) m_var_items.array()) + var_idx; } Item_field *get_parameter(uint var_idx) const { DBUG_ASSERT(var_idx < argument_count()); return get_variable(var_idx); } bool find_row_field_by_name_or_error(uint *field_idx, uint var_idx, const LEX_CSTRING &field_name); bool set_return_value(THD *thd, Item **return_value_item); bool is_return_value_set() const { return m_return_value_set; } ///////////////////////////////////////////////////////////////////////// // SQL-handlers. ///////////////////////////////////////////////////////////////////////// /// Push an sp_instr_hpush_jump instance to the handler call stack. /// /// @param entry The condition handler entry /// /// @return error flag. /// @retval false on success. /// @retval true on error. bool push_handler(sp_instr_hpush_jump *entry); /// Pop and delete given number of instances from the handler /// call stack. /// /// @param count Number of handler entries to pop & delete. void pop_handlers(size_t count); const Sql_condition_info *raised_condition() const { return m_handler_call_stack.elements() ? (*m_handler_call_stack.back())->sql_condition : NULL; } /// Handle current SQL condition (if any). /// /// This is the public-interface function to handle SQL conditions in /// stored routines. /// /// @param thd Thread handle. /// @param ip[out] Instruction pointer to the first handler /// instruction. /// @param cur_spi Current SP instruction. /// /// @retval 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. /// /// @retval false otherwise. bool handle_sql_condition(THD *thd, uint *ip, const sp_instr *cur_spi); /// Remove latest call frame from the handler call stack. /// /// @param da Diagnostics area containing handled conditions. /// /// @return continue instruction pointer of the removed handler. uint exit_handler(Diagnostics_area *da); ///////////////////////////////////////////////////////////////////////// // Cursors. ///////////////////////////////////////////////////////////////////////// /// Push a cursor to the cursor stack. /// /// @param cursor The cursor /// void push_cursor(sp_cursor *cur); void pop_cursor(THD *thd); /// Pop and delete given number of sp_cursor instance from the cursor stack. /// /// @param count Number of cursors to pop & delete. void pop_cursors(THD *thd, size_t count); void pop_all_cursors(THD *thd) { pop_cursors(thd, m_ccount); } sp_cursor *get_cursor(uint i) const { return m_cstack[i]; } ///////////////////////////////////////////////////////////////////////// // CASE expressions. ///////////////////////////////////////////////////////////////////////// /// Set CASE expression to the specified value. /// /// @param thd Thread handler. /// @param case_expr_id The CASE expression identifier. /// @param case_expr_item The CASE expression value /// /// @return error flag. /// @retval false on success. /// @retval 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. bool set_case_expr(THD *thd, int case_expr_id, Item **case_expr_item_ptr); Item *get_case_expr(int case_expr_id) const { return m_case_expr_holders[case_expr_id]; } Item ** get_case_expr_addr(int case_expr_id) const { return (Item**) m_case_expr_holders.array() + case_expr_id; } private: /// Internal function to allocate memory for arrays. /// /// @param thd Thread handle. /// /// @return error flag: false on success, true in case of failure. bool alloc_arrays(THD *thd); /// Create and initialize a table to store SP-variables. /// /// param thd Thread handle. /// /// @return error flag. /// @retval false on success. /// @retval true on error. bool init_var_table(THD *thd, List<Spvar_definition> &defs); /// Create and initialize an Item-adapter (Item_field) for each SP-var field. /// /// param thd Thread handle. /// /// @return error flag. /// @retval false on success. /// @retval true on error. bool init_var_items(THD *thd, List<Spvar_definition> &defs); /// Create an instance of appropriate Item_cache class depending on the /// specified type in the callers arena. /// /// @note We should create cache items in the callers arena, as they are /// used between in several instructions. /// /// @param thd Thread handler. /// @param item Item to get the expression type. /// /// @return Pointer to valid object on success, or NULL in case of error. Item_cache *create_case_expr_holder(THD *thd, const Item *item) const; Virtual_tmp_table *virtual_tmp_table_for_row(uint idx); private: /// Top-level (root) parsing context for this runtime context. const sp_pcontext *m_root_parsing_ctx; /// Virtual table for storing SP-variables. Virtual_tmp_table *m_var_table; /// Collection of Item_field proxies, each of them points to the /// corresponding field in m_var_table. Bounds_checked_array<Item_field *> m_var_items; /// This is a pointer to a field, which should contain return value for /// stored functions (only). For stored procedures, this pointer is NULL. Field *m_return_value_fld; /// Indicates whether the return value (in m_return_value_fld) has been /// set during execution. bool m_return_value_set; /// Flag to tell if the runtime context is created for a sub-statement. bool m_in_sub_stmt; /// Stack of visible handlers. Dynamic_array<sp_instr_hpush_jump *> m_handlers; /// Stack of caught SQL conditions. Dynamic_array<Handler_call_frame *> m_handler_call_stack; /// Stack of cursors. Bounds_checked_array<sp_cursor *> m_cstack; /// Current number of cursors in m_cstack. uint m_ccount; /// Array of CASE expression holders. Bounds_checked_array<Item_cache *> m_case_expr_holders; }; // class sp_rcontext : public Sql_alloc #endif /* _SP_RCONTEXT_H_ */
Save
cmd:
run