From f5b60857f49f886926530b2e28cbf9e179658014 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 25 Jun 2018 18:57:32 +0400 Subject: A cleanup for 84c55a5668db582aa92dd2ccf076fbb783894b12 (that implemented cursor FOR loops earlier): MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR LOOP MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop Cleanup changes: - Removing sp_lex_cursor::m_cursor_name - Adding sp_instr_cursor_copy_struct::m_cursor (the cursor global index) - Fixing sp_instr_cursor_copy_struct::print() to access to the cursor name using m_ctx and m_cursor (like other cursor related instructions do) instead of m_cursor_name. This change is needed to unify sp_assignment_lex and sp_cursor_lex later, to fix this problem easier: MDEV-16558 Parenthesized expression does not work as a lower FOR loop bound --- sql/sp_head.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql/sp_head.cc') diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 3a9e83d9d09..3b90c1af604 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -4506,7 +4506,7 @@ void sp_instr_cursor_copy_struct::print(String *str) { sp_variable *var= m_ctx->find_variable(m_var); - const LEX_CSTRING *name= m_lex_keeper.cursor_name(); + const LEX_CSTRING *name= m_ctx->find_cursor(m_cursor); str->append(STRING_WITH_LEN("cursor_copy_struct ")); str->append(name); str->append(' '); @@ -5001,7 +5001,8 @@ bool sp_head::add_for_loop_open_cursor(THD *thd, sp_pcontext *spcont, sp_instr *instr_copy_struct= new (thd->mem_root) sp_instr_cursor_copy_struct(instructions(), - spcont, pcursor->lex(), + spcont, coffset, + pcursor->lex(), index->offset); if (instr_copy_struct == NULL || add_instr(instr_copy_struct)) return true; -- cgit v1.2.1