mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
Fixed BUG#3287: Stored Procedure Case Statement Not SQL:2003 Compliant.
This commit is contained in:
parent
52c820fbc5
commit
329013f99e
28 changed files with 83 additions and 3 deletions
|
@ -342,4 +342,5 @@
|
|||
#define ER_SP_NO_USE 1323
|
||||
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1324
|
||||
#define ER_SP_CURSOR_AFTER_HANDLER 1325
|
||||
#define ER_ERROR_MESSAGES 326
|
||||
#define ER_SP_CASE_NOT_FOUND 1326
|
||||
#define ER_ERROR_MESSAGES 327
|
||||
|
|
|
@ -199,3 +199,4 @@ ER_SP_SUBSELECT_NYI, "0A000", "",
|
|||
ER_SP_NO_USE, "42000", "",
|
||||
ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
|
||||
ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
|
||||
ER_SP_CASE_NOT_FOUND, "20000", "",
|
||||
|
|
|
@ -341,4 +341,25 @@ call bug2329_2()|
|
|||
ERROR 42S22: Unknown column 'v' in 'field list'
|
||||
drop procedure bug2329_1|
|
||||
drop procedure bug2329_2|
|
||||
create function bug3287() returns int
|
||||
begin
|
||||
declare v int default null;
|
||||
case
|
||||
when v is not null then return 1;
|
||||
end case;
|
||||
return 2;
|
||||
end|
|
||||
select bug3287()|
|
||||
ERROR 20000: Case not found for CASE statement
|
||||
drop function bug3287|
|
||||
create procedure bug3287(x int)
|
||||
case x
|
||||
when 0 then
|
||||
insert into test.t1 values (x, 0.1);
|
||||
when 1 then
|
||||
insert into test.t1 values (x, 1.1);
|
||||
end case|
|
||||
call bug3287(2)|
|
||||
ERROR 20000: Case not found for CASE statement
|
||||
drop procedure bug3287|
|
||||
drop table t1|
|
||||
|
|
|
@ -473,6 +473,33 @@ call bug2329_2()|
|
|||
drop procedure bug2329_1|
|
||||
drop procedure bug2329_2|
|
||||
|
||||
#
|
||||
# BUG#3287
|
||||
#
|
||||
create function bug3287() returns int
|
||||
begin
|
||||
declare v int default null;
|
||||
|
||||
case
|
||||
when v is not null then return 1;
|
||||
end case;
|
||||
return 2;
|
||||
end|
|
||||
--error 1326
|
||||
select bug3287()|
|
||||
drop function bug3287|
|
||||
|
||||
create procedure bug3287(x int)
|
||||
case x
|
||||
when 0 then
|
||||
insert into test.t1 values (x, 0.1);
|
||||
when 1 then
|
||||
insert into test.t1 values (x, 1.1);
|
||||
end case|
|
||||
--error 1326
|
||||
call bug3287(2)|
|
||||
drop procedure bug3287|
|
||||
|
||||
drop table t1|
|
||||
|
||||
delimiter ;|
|
||||
|
|
|
@ -338,3 +338,4 @@ character-set=latin2
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -332,3 +332,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -340,3 +340,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -334,3 +334,4 @@ character-set=latin7
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -341,3 +341,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=greek
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=latin2
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=ujis
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=euckr
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -333,3 +333,4 @@ character-set=latin2
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -330,3 +330,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -333,3 +333,4 @@ character-set=latin2
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=koi8r
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -324,3 +324,4 @@ character-set=cp1250
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -337,3 +337,4 @@ character-set=latin2
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -331,3 +331,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -329,3 +329,4 @@ character-set=latin1
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -334,3 +334,4 @@ character-set=koi8u
|
|||
"USE is not allowed in a stored procedure"
|
||||
"Variable or condition declaration after cursor or handler declaration"
|
||||
"Cursor declaration after handler declaration"
|
||||
"Case not found for CASE statement"
|
||||
|
|
|
@ -1908,9 +1908,16 @@ sp_case:
|
|||
;
|
||||
|
||||
sp_whens:
|
||||
/* Empty */ {}
|
||||
| WHEN_SYM sp_case {}
|
||||
/* Empty */
|
||||
{
|
||||
sp_head *sp= Lex->sphead;
|
||||
uint ip= sp->instructions();
|
||||
sp_instr_error *i= new sp_instr_error(ip, ER_SP_CASE_NOT_FOUND);
|
||||
|
||||
sp->add_instr(i);
|
||||
}
|
||||
| ELSE sp_proc_stmts {}
|
||||
| WHEN_SYM sp_case {}
|
||||
;
|
||||
|
||||
sp_labeled_control:
|
||||
|
|
Loading…
Reference in a new issue