mirror of
https://github.com/MariaDB/server.git
synced 2026-05-04 22:25:32 +02:00
Fixed BUG#9073: Able to declare two handlers for same condition in same scope
This commit is contained in:
parent
e6d72f1c48
commit
2038ced40c
6 changed files with 170 additions and 7 deletions
|
|
@ -57,6 +57,7 @@ sp_pcontext::sp_pcontext(sp_pcontext *prev)
|
|||
VOID(my_init_dynamic_array(&m_pvar, sizeof(sp_pvar_t *), 16, 8));
|
||||
VOID(my_init_dynamic_array(&m_cond, sizeof(sp_cond_type_t *), 16, 8));
|
||||
VOID(my_init_dynamic_array(&m_cursor, sizeof(LEX_STRING), 16, 8));
|
||||
VOID(my_init_dynamic_array(&m_handler, sizeof(sp_cond_type_t *), 16, 8));
|
||||
m_label.empty();
|
||||
m_children.empty();
|
||||
if (!prev)
|
||||
|
|
@ -82,6 +83,7 @@ sp_pcontext::destroy()
|
|||
delete_dynamic(&m_pvar);
|
||||
delete_dynamic(&m_cond);
|
||||
delete_dynamic(&m_cursor);
|
||||
delete_dynamic(&m_handler);
|
||||
}
|
||||
|
||||
sp_pcontext *
|
||||
|
|
@ -258,6 +260,41 @@ sp_pcontext::find_cond(LEX_STRING *name, my_bool scoped)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* This only searches the current context, for error checking of
|
||||
* duplicates.
|
||||
* Returns TRUE if found.
|
||||
*/
|
||||
bool
|
||||
sp_pcontext::find_handler(sp_cond_type_t *cond)
|
||||
{
|
||||
uint i= m_handler.elements;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
sp_cond_type_t *p;
|
||||
|
||||
get_dynamic(&m_handler, (gptr)&p, i);
|
||||
if (cond->type == p->type)
|
||||
{
|
||||
switch (p->type)
|
||||
{
|
||||
case sp_cond_type_t::number:
|
||||
if (cond->mysqlerr == p->mysqlerr)
|
||||
return TRUE;
|
||||
break;
|
||||
case sp_cond_type_t::state:
|
||||
if (strcmp(cond->sqlstate, p->sqlstate) == 0)
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
sp_pcontext::push_cursor(LEX_STRING *name)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue