summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.cc
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2005-09-26 18:46:31 +0200
committerunknown <pem@mysql.com>2005-09-26 18:46:31 +0200
commita5925a90e24cfb793d69629d41aafd3472157470 (patch)
treef82078b116d6f50b1f6b9d1fcc5a7dc39b684176 /sql/sp_rcontext.cc
parentad8ff14165ed656aee697b49eac6c7e8cb5a5c00 (diff)
downloadmariadb-git-a5925a90e24cfb793d69629d41aafd3472157470.tar.gz
Fixed BUG#7049: Stored procedure CALL errors are ignored
Search the chain of sp_rcontexts recursively for handlers. If one is found, it will be detected in the sp_head::execute() method at the corresponding level. mysql-test/r/sp.result: New test case for BUG#7049. Note that the spurious warnings in the BUG#12379 test now are gone (as expected). mysql-test/t/sp.test: New test case for BUG#7049. sql/sp_head.cc: Link sp_rcontexts to allow catching errors across invokation boundaries. (Also fixed print method for the hreturn instruction.) sql/sp_rcontext.cc: Link sp_rcontexts to allow catching errors across invokation boundaries. If a handler is not found in the current sp_rcontext, recurse into the previous ones (if any). sql/sp_rcontext.h: Link sp_rcontexts to allow catching errors across invokation boundaries.
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r--sql/sp_rcontext.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 252bd7e5cab..ccb38358049 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -29,9 +29,9 @@
#include "sp_rcontext.h"
#include "sp_pcontext.h"
-sp_rcontext::sp_rcontext(uint fsize, uint hmax, uint cmax)
+sp_rcontext::sp_rcontext(sp_rcontext *prev, uint fsize, uint hmax, uint cmax)
: m_count(0), m_fsize(fsize), m_result(NULL), m_hcount(0), m_hsp(0),
- m_ihsp(0), m_hfound(-1), m_ccount(0)
+ m_ihsp(0), m_hfound(-1), m_ccount(0), m_prev_ctx(prev)
{
m_frame= (Item **)sql_alloc(fsize * sizeof(Item*));
m_handler= (sp_handler_t *)sql_alloc(hmax * sizeof(sp_handler_t));
@@ -116,7 +116,11 @@ sp_rcontext::find_handler(uint sql_errno,
}
}
if (found < 0)
+ {
+ if (m_prev_ctx)
+ return m_prev_ctx->find_handler(sql_errno, level);
return FALSE;
+ }
m_hfound= found;
return TRUE;
}