mirror of
https://github.com/MariaDB/server.git
synced 2026-04-22 08:15:31 +02:00
Fixed BUG#8760: Stored Procedures: Invalid SQLSTATE is allowed in
a DECLARE ? HANDLER FOR stmt. mysql-test/r/sp-error.result: New test case for BUG#8776 (check format of sqlstates in handler declarations). mysql-test/t/sp-error.test: New test case for BUG#8776 (check format of sqlstates in handler declarations). sql/share/errmsg.txt: New error message for malformed SQLSTATEs. sql/sp_pcontext.cc: Added function for checking SQLSTATE format. sql/sp_pcontext.h: Added function for checking SQLSTATE format. sql/sql_yacc.yy: Check format of SQLSTATE in handler declaration.
This commit is contained in:
parent
cfff7e6e18
commit
110f6abd38
6 changed files with 105 additions and 5 deletions
|
|
@ -26,6 +26,30 @@
|
|||
#include "sp_pcontext.h"
|
||||
#include "sp_head.h"
|
||||
|
||||
/*
|
||||
* Sanity check for SQLSTATEs. Will not check if it's really an existing
|
||||
* state (there are just too many), but will check length and bad characters.
|
||||
* Returns TRUE if it's ok, FALSE if it's bad.
|
||||
*/
|
||||
bool
|
||||
sp_cond_check(LEX_STRING *sqlstate)
|
||||
{
|
||||
int i;
|
||||
const char *p;
|
||||
|
||||
if (sqlstate->length != 5)
|
||||
return FALSE;
|
||||
for (p= sqlstate->str, i= 0 ; i < 5 ; i++)
|
||||
{
|
||||
char c = p[i];
|
||||
|
||||
if ((c < '0' || '9' < c) &&
|
||||
(c < 'A' || 'Z' < c))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
sp_pcontext::sp_pcontext(sp_pcontext *prev)
|
||||
: Sql_alloc(), m_psubsize(0), m_csubsize(0), m_hsubsize(0),
|
||||
m_handlers(0), m_parent(prev)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue