We'll solve MDEV-13418 by translating:
Notice, this will need auto-generated assignments between SP variables (a=a_tmp and b=b_tmp).
Normally assignment is done via sp_instr_set, but it does not suite well here because it needs:
- an Item for the assignment source
- a LEX containing this Item
Instead of creating an Item and a LEX (whose sizeof are 208 and 5896 bytes respectively),
we'll introduce a new sp_instr_setvar which will copy between two variables directly, with no Item and LEX, using their offsets in sp_rcontext::m_var_table.
In order to implement this, we'll need some changes for ROW-type SP variables.
Currently ROW variables store their members inside Item_splocal_row::m_table.
We'll do the following:
- Create a new class Field_row and move m_table from Item_splocal_row to Field_row
- Remove the class Item_splocal_row and use Item_splocal instead by passing &type_handler_row to the constructor.
- Change Item_splocal::Item_splocal to accept const Type_handler *handler instead of enum_field_types sp_var_type.
- Remove the class Item_spvar_args and derive Item_field_row directly from Item_args
- Move row_create_items() and get_row_field() from Item_spvar_args to Item_field_row and fix them to use Field_row::m_table instead of Item_spvar_args::m_table.
- Replace DBUG_ASSERT in Type_handler_row::Column_definition_fix_attributes(), Type_handler_row::Column_definition_prepare_stage1(), Type_handler_row::Column_definition_prepare_stage2() to real appropriate implementations.