mirror of
https://github.com/MariaDB/server.git
synced 2025-07-10 05:18:14 +02:00
![]() It was not possible to use a package body variable as a fetch target: CREATE PACKAGE BODY pkg AS vc INT := 0; FUNCTION f1 RETURN INT AS CURSOR cur IS SELECT 1 AS c FROM DUAL; BEGIN OPEN cur; FETCH cur INTO vc; -- this returned "Undeclared variable: vc" error. CLOSE cur; RETURN vc; END; END; FETCH assumed that all fetch targets reside of the same sp_rcontext instance with the cursor. This patch fixes the problem. Now a cursor and its fetch target can reside in different sp_rcontext instances. Details: - Adding a helper class sp_rcontext_addr (a combination of Sp_rcontext_handler pointer and an offset in the rcontext) - Adding a new class sp_fetch_target deriving from sp_rcontext_addr. Fetch targets in "FETCH cur INTO target1, target2 ..." are now collected into this structure instead of sp_variable. sp_variable cannot be used any more to store fetch targets, because it does not have a pointer to Sp_rcontext_handler (it only has the current rcontext offset). - Removing members sp_instr_set members m_rcontext_handler and m_offset. Deriving sp_instr_set from sp_rcontext_addr instead. - Renaming sp_instr_cfetch member "List<sp_variable> m_varlist" to "List<sp_fetch_target> m_fetch_target_list". - Fixing LEX::sp_add_cfetch() to return the pointer to the created sp_fetch_target instance (instead of returning bool). This helps to make the grammar in sql_yacc.c simpler - Renaming LEX::sp_add_cfetch() to LEX::sp_add_instr_cfetch(), as `if(sp_add_cfetch())` changed its meaning to the opposite, to avoid automatic wrong merge from earlier versions. - Chaning the "List<sp_variable> *vars" parameter to sp_cursor::fetch to have the data type "List<sp_fetch_target> *". - Changing the data type of "List<sp_variable> &vars" in sp_cursor::Select_fetch_into_spvars::send_data_to_variable_list() to "List<sp_fetch_target> &". - Adding THD helper methods get_rcontext() and get_variable(). - Moving the code from sql_yacc.yy into a new LEX method LEX::make_fetch_target(). - Simplifying the grammar in sql_yacc.yy using the new LEX method. Changing the data type of the bison rule sp_fetch_list from "void" to "List<sp_fetch_target> *". |
||
---|---|---|
.. | ||
anonymous_derived.result | ||
binlog_ptr_mysqlbinlog.result | ||
binlog_stm_ps.result | ||
binlog_stm_sp.result | ||
binlog_stm_sp_package.result | ||
column_compression.result | ||
custom_aggregate_functions.result | ||
empty_string_literal.result | ||
events.result | ||
exception.result | ||
func_add_months.result | ||
func_case.result | ||
func_concat.result | ||
func_decode.result | ||
func_length.result | ||
func_misc.result | ||
func_pad.result | ||
func_qualified.result | ||
func_regexp_replace.result | ||
func_replace.result | ||
func_substr.result | ||
func_time.result | ||
func_to_char.result | ||
func_trim.result | ||
gis-debug.result | ||
gis.result | ||
information_schema_parameters.result | ||
keywords.result | ||
minus.result | ||
misc.result | ||
mysqldump_restore.result | ||
mysqldump_restore_func_qualified.result | ||
parser.result | ||
plugin.result | ||
ps.result | ||
rpl_mariadb_date.result | ||
rpl_sp_package.result | ||
rpl_sp_package_variables.result | ||
sequence.result | ||
sp-anchor-row-type-table.result | ||
sp-anonymous.result | ||
sp-code.result | ||
sp-cursor-decl.result | ||
sp-cursor-rowtype.result | ||
sp-cursor.result | ||
sp-expr.result | ||
sp-goto-debug.result | ||
sp-goto.result | ||
sp-inout.result | ||
sp-memory-leak.result | ||
sp-package-code.result | ||
sp-package-concurrent-dml-db.result | ||
sp-package-concurrent-dml-package.result | ||
sp-package-concurrent-dml-trigger.result | ||
sp-package-concurrent-dml-view.result | ||
sp-package-i_s.result | ||
sp-package-innodb.result | ||
sp-package-mdl.result | ||
sp-package-mysqldump.result | ||
sp-package-security.result | ||
sp-package.result | ||
sp-param.result | ||
sp-row.result | ||
sp-security.result | ||
sp.result | ||
statement-expr.result | ||
table_value_constr.result | ||
trigger.result | ||
truncate.result | ||
type_blob.result | ||
type_clob.result | ||
type_date.result | ||
type_number.result | ||
type_raw.result | ||
type_varchar.result | ||
type_varchar2.result | ||
update.result | ||
update_innodb.result | ||
variables.result | ||
vcol.result | ||
vcol_innodb.result | ||
versioning.result | ||
win.result |