diff options
author | pem@mysql.com <> | 2005-09-26 18:46:31 +0200 |
---|---|---|
committer | pem@mysql.com <> | 2005-09-26 18:46:31 +0200 |
commit | 6a84506af777a19fbe730cae322d387b28e331f4 (patch) | |
tree | f82078b116d6f50b1f6b9d1fcc5a7dc39b684176 /sql | |
parent | 6ac4c47f7be331733559455ae963921f28ec7f8a (diff) | |
download | mariadb-git-6a84506af777a19fbe730cae322d387b28e331f4.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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sp_head.cc | 9 | ||||
-rw-r--r-- | sql/sp_rcontext.cc | 8 | ||||
-rw-r--r-- | sql/sp_rcontext.h | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 671acbc2a0c..ab0e42a7ab6 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1110,7 +1110,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) DBUG_RETURN(-1); // QQ Should have some error checking here? (types, etc...) - if (!(nctx= new sp_rcontext(csize, hmax, cmax))) + if (!(nctx= new sp_rcontext(octx, csize, hmax, cmax))) goto end; for (i= 0 ; i < argcount ; i++) { @@ -1254,7 +1254,7 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args) save_spcont= octx= thd->spcont; if (! octx) { // Create a temporary old context - if (!(octx= new sp_rcontext(csize, hmax, cmax))) + if (!(octx= new sp_rcontext(octx, csize, hmax, cmax))) DBUG_RETURN(-1); thd->spcont= octx; @@ -1262,7 +1262,7 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args) thd->spcont->callers_arena= thd; } - if (!(nctx= new sp_rcontext(csize, hmax, cmax))) + if (!(nctx= new sp_rcontext(octx, csize, hmax, cmax))) { thd->spcont= save_spcont; DBUG_RETURN(-1); @@ -2390,7 +2390,10 @@ sp_instr_hreturn::print(String *str) str->append("hreturn "); str->qs_append(m_frame); if (m_dest) + { + str->append(' '); str->qs_append(m_dest); + } } 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; } diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 22fa4f6e865..c7a298eccc0 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -66,7 +66,7 @@ class sp_rcontext : public Sql_alloc */ Query_arena *callers_arena; - sp_rcontext(uint fsize, uint hmax, uint cmax); + sp_rcontext(sp_rcontext *prev, uint fsize, uint hmax, uint cmax); ~sp_rcontext() { @@ -226,6 +226,8 @@ private: sp_cursor **m_cstack; uint m_ccount; + sp_rcontext *m_prev_ctx; // Previous context (NULL if none) + }; // class sp_rcontext : public Sql_alloc |