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.cc | |
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.cc')
-rw-r--r-- | sql/sp_rcontext.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index fcb7719aeb1..252bd7e5cab 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -31,12 +31,12 @@ sp_rcontext::sp_rcontext(uint fsize, uint hmax, uint cmax) : m_count(0), m_fsize(fsize), m_result(NULL), m_hcount(0), m_hsp(0), - m_hfound(-1), m_ccount(0) + m_ihsp(0), m_hfound(-1), m_ccount(0) { - in_handler= FALSE; m_frame= (Item **)sql_alloc(fsize * sizeof(Item*)); m_handler= (sp_handler_t *)sql_alloc(hmax * sizeof(sp_handler_t)); m_hstack= (uint *)sql_alloc(hmax * sizeof(uint)); + m_in_handler= (uint *)sql_alloc(hmax * sizeof(uint)); m_cstack= (sp_cursor **)sql_alloc(cmax * sizeof(sp_cursor *)); m_saved.empty(); } @@ -68,8 +68,6 @@ bool sp_rcontext::find_handler(uint sql_errno, MYSQL_ERROR::enum_warning_level level) { - if (in_handler) - return 0; // Already executing a handler if (m_hfound >= 0) return 1; // Already got one @@ -79,6 +77,13 @@ sp_rcontext::find_handler(uint sql_errno, while (i--) { sp_cond_type_t *cond= m_handler[i].cond; + int j= m_ihsp; + + while (j--) + if (m_in_handler[j] == m_handler[i].handler) + break; + if (j >= 0) + continue; // Already executing this handler switch (cond->type) { |