diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-25 18:57:32 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-25 19:20:36 +0400 |
commit | f5b60857f49f886926530b2e28cbf9e179658014 (patch) | |
tree | 166d9fa4f8f89eec673c816814a311a856d3be80 /sql/sp_head.h | |
parent | 1ba5b38bfa9a7334bfb3f8899a2b992cd05340a2 (diff) | |
download | mariadb-git-f5b60857f49f886926530b2e28cbf9e179658014.tar.gz |
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
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r-- | sql/sp_head.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h index c0c0c83b77e..dcea4191cde 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -1004,12 +1004,10 @@ public: class sp_lex_cursor: public sp_lex_local, public Query_arena { - LEX_CSTRING m_cursor_name; public: sp_lex_cursor(THD *thd, const LEX *oldlex, MEM_ROOT *mem_root_arg) :sp_lex_local(thd, oldlex), - Query_arena(mem_root_arg, STMT_INITIALIZED_FOR_SP), - m_cursor_name(null_clex_str) + Query_arena(mem_root_arg, STMT_INITIALIZED_FOR_SP) { } sp_lex_cursor(THD *thd, const LEX *oldlex) :sp_lex_local(thd, oldlex), @@ -1037,8 +1035,6 @@ public: thd->free_list= NULL; return false; } - const LEX_CSTRING *cursor_name() const { return &m_cursor_name; } - void set_cursor_name(const LEX_CSTRING *name) { m_cursor_name= *name; } }; @@ -1213,10 +1209,6 @@ public: m_lex->safe_to_cache_query= 0; } - const LEX_CSTRING *cursor_name() const - { - return m_lex->cursor_name(); - } private: LEX *m_lex; @@ -1864,11 +1856,14 @@ class sp_instr_cursor_copy_struct: public sp_instr sp_instr_cursor_copy_struct(const sp_instr_cursor_copy_struct &); void operator=(sp_instr_cursor_copy_struct &); sp_lex_keeper m_lex_keeper; + uint m_cursor; uint m_var; public: - sp_instr_cursor_copy_struct(uint ip, sp_pcontext *ctx, + sp_instr_cursor_copy_struct(uint ip, sp_pcontext *ctx, uint coffs, sp_lex_cursor *lex, uint voffs) - : sp_instr(ip, ctx), m_lex_keeper(lex, FALSE), m_var(voffs) + : sp_instr(ip, ctx), m_lex_keeper(lex, FALSE), + m_cursor(coffs), + m_var(voffs) {} virtual ~sp_instr_cursor_copy_struct() {} |