diff options
author | unknown <pem@mysql.com> | 2005-09-26 18:22:00 +0200 |
---|---|---|
committer | unknown <pem@mysql.com> | 2005-09-26 18:22:00 +0200 |
commit | ad8ff14165ed656aee697b49eac6c7e8cb5a5c00 (patch) | |
tree | a751b9a10f86ec7538d34a5e7a81a973627b9de7 /sql/sp_rcontext.h | |
parent | 4aa9a107413c3c614984f4c0bca2d63f4396041b (diff) | |
download | mariadb-git-ad8ff14165ed656aee697b49eac6c7e8cb5a5c00.tar.gz |
Fixed BUG#6127: Stored procedure handlers within handlers don't work
Replaced the dumb in-handler/not-in-handler check with a proper recursion
check of handlers being executed.
(Re-commit in a different tree, to make push possible.)
mysql-test/r/sp.result:
New test case for BUG#6127.
mysql-test/t/sp.test:
New test case for BUG#6127.
sql/sp_head.cc:
Replaced the setting of ctx->in_handler with a enter/exit handler methods.
sql/sp_rcontext.cc:
Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
sql/sp_rcontext.h:
Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
(And added some comments in the sp_rcontext class.)
Diffstat (limited to 'sql/sp_rcontext.h')
-rw-r--r-- | sql/sp_rcontext.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 9c0fa88fe34..22fa4f6e865 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -58,7 +58,6 @@ class sp_rcontext : public Sql_alloc public: - bool in_handler; /* Arena used to (re) allocate items on . E.g. reallocate INOUT/OUT SP parameters when they don't fit into prealloced items. This @@ -169,6 +168,18 @@ class sp_rcontext : public Sql_alloc return m_hstack[--m_hsp]; } + inline void + enter_handler(int hid) + { + m_in_handler[m_ihsp++]= hid; + } + + inline void + exit_handler() + { + m_ihsp-= 1; + } + // Save variables starting at fp and up void save_variables(uint fp); @@ -203,12 +214,14 @@ private: Item *m_result; // For FUNCTIONs - sp_handler_t *m_handler; - uint m_hcount; - uint *m_hstack; - uint m_hsp; - int m_hfound; // Set by find_handler; -1 if not found - List<Item> m_saved; // Saved variables + sp_handler_t *m_handler; // Visible handlers + uint m_hcount; // Stack pointer for m_handler + uint *m_hstack; // Return stack for continue handlers + uint m_hsp; // Stack pointer for m_hstack + uint *m_in_handler; // Active handler, for recursion check + uint m_ihsp; // Stack pointer for m_in_handler + int m_hfound; // Set by find_handler; -1 if not found + List<Item> m_saved; // Saved variables during handler exec. sp_cursor **m_cstack; uint m_ccount; |