mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-limit-5.0
This commit is contained in:
@@ -340,4 +340,7 @@
|
|||||||
#define ER_SP_CANT_ALTER 1321
|
#define ER_SP_CANT_ALTER 1321
|
||||||
#define ER_SP_SUBSELECT_NYI 1322
|
#define ER_SP_SUBSELECT_NYI 1322
|
||||||
#define ER_SP_NO_USE 1323
|
#define ER_SP_NO_USE 1323
|
||||||
#define ER_ERROR_MESSAGES 324
|
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1324
|
||||||
|
#define ER_SP_CURSOR_AFTER_HANDLER 1325
|
||||||
|
#define ER_SP_CASE_NOT_FOUND 1326
|
||||||
|
#define ER_ERROR_MESSAGES 327
|
||||||
|
@@ -197,3 +197,6 @@ ER_SP_DUP_CURS, "42000", "",
|
|||||||
/*ER_SP_CANT_ALTER*/
|
/*ER_SP_CANT_ALTER*/
|
||||||
ER_SP_SUBSELECT_NYI, "0A000", "",
|
ER_SP_SUBSELECT_NYI, "0A000", "",
|
||||||
ER_SP_NO_USE, "42000", "",
|
ER_SP_NO_USE, "42000", "",
|
||||||
|
ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
|
||||||
|
ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
|
||||||
|
ER_SP_CASE_NOT_FOUND, "20000", "",
|
||||||
|
@@ -194,8 +194,8 @@ create table t1 (val int, x float)|
|
|||||||
insert into t1 values (42, 3.1), (19, 1.2)|
|
insert into t1 values (42, 3.1), (19, 1.2)|
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
open c;
|
open c;
|
||||||
fetch c into x, y;
|
fetch c into x, y;
|
||||||
close c;
|
close c;
|
||||||
@@ -203,8 +203,8 @@ end|
|
|||||||
ERROR 42000: Undeclared variable: y
|
ERROR 42000: Undeclared variable: y
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
open c;
|
open c;
|
||||||
fetch c into x;
|
fetch c into x;
|
||||||
close c;
|
close c;
|
||||||
@@ -214,10 +214,10 @@ ERROR HY000: Wrong number of FETCH variables
|
|||||||
drop procedure p|
|
drop procedure p|
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
declare y float;
|
declare y float;
|
||||||
declare z int;
|
declare z int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
open c;
|
open c;
|
||||||
fetch c into x, y, z;
|
fetch c into x, y, z;
|
||||||
close c;
|
close c;
|
||||||
@@ -252,9 +252,28 @@ declare c cursor for select field from t1;
|
|||||||
end|
|
end|
|
||||||
ERROR 42000: Duplicate cursor: c
|
ERROR 42000: Duplicate cursor: c
|
||||||
create procedure u()
|
create procedure u()
|
||||||
use sptmp;
|
use sptmp|
|
||||||
#|
|
|
||||||
ERROR 42000: USE is not allowed in a stored procedure
|
ERROR 42000: USE is not allowed in a stored procedure
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
declare x int;
|
||||||
|
end|
|
||||||
|
ERROR 42000: Variable or condition declaration after cursor or handler declaration
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare x int;
|
||||||
|
declare continue handler for sqlstate '42S99' set x = 1;
|
||||||
|
declare foo condition for sqlstate '42S99';
|
||||||
|
end|
|
||||||
|
ERROR 42000: Variable or condition declaration after cursor or handler declaration
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare x int;
|
||||||
|
declare continue handler for sqlstate '42S99' set x = 1;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
end|
|
||||||
|
ERROR 42000: Cursor declaration after handler declaration
|
||||||
create procedure bug1965()
|
create procedure bug1965()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select val from t1 order by valname;
|
declare c cursor for select val from t1 order by valname;
|
||||||
@@ -322,4 +341,25 @@ call bug2329_2()|
|
|||||||
ERROR 42S22: Unknown column 'v' in 'field list'
|
ERROR 42S22: Unknown column 'v' in 'field list'
|
||||||
drop procedure bug2329_1|
|
drop procedure bug2329_1|
|
||||||
drop procedure bug2329_2|
|
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|
|
drop table t1|
|
||||||
|
@@ -660,12 +660,12 @@ drop table t3|
|
|||||||
drop procedure hndlr4|
|
drop procedure hndlr4|
|
||||||
create procedure cur1()
|
create procedure cur1()
|
||||||
begin
|
begin
|
||||||
declare done int default 0;
|
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c cursor for select * from test.t2;
|
|
||||||
declare a char(16);
|
declare a char(16);
|
||||||
declare b int;
|
declare b int;
|
||||||
declare c double;
|
declare c double;
|
||||||
|
declare done int default 0;
|
||||||
|
declare c cursor for select * from test.t2;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
open c;
|
open c;
|
||||||
repeat
|
repeat
|
||||||
fetch c into a, b, c;
|
fetch c into a, b, c;
|
||||||
@@ -688,9 +688,9 @@ create table t3 ( s char(16), i int )|
|
|||||||
create procedure cur2()
|
create procedure cur2()
|
||||||
begin
|
begin
|
||||||
declare done int default 0;
|
declare done int default 0;
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c1 cursor for select id,data from test.t1;
|
declare c1 cursor for select id,data from test.t1;
|
||||||
declare c2 cursor for select i from test.t2;
|
declare c2 cursor for select i from test.t2;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
open c1;
|
open c1;
|
||||||
open c2;
|
open c2;
|
||||||
repeat
|
repeat
|
||||||
@@ -764,8 +764,8 @@ create procedure modes(out c1 int, out c2 int)
|
|||||||
begin
|
begin
|
||||||
declare done int default 0;
|
declare done int default 0;
|
||||||
declare x int;
|
declare x int;
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c cursor for select data from t1;
|
declare c cursor for select data from t1;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
select 1 || 2 into c1;
|
select 1 || 2 into c1;
|
||||||
set c2 = 0;
|
set c2 = 0;
|
||||||
open c;
|
open c;
|
||||||
@@ -915,8 +915,8 @@ drop procedure bug1874|
|
|||||||
create procedure bug2260()
|
create procedure bug2260()
|
||||||
begin
|
begin
|
||||||
declare v1 int;
|
declare v1 int;
|
||||||
declare continue handler for not found set @x2 = 1;
|
|
||||||
declare c1 cursor for select data from t1;
|
declare c1 cursor for select data from t1;
|
||||||
|
declare continue handler for not found set @x2 = 1;
|
||||||
open c1;
|
open c1;
|
||||||
fetch c1 into v1;
|
fetch c1 into v1;
|
||||||
set @x2 = 2;
|
set @x2 = 2;
|
||||||
@@ -996,10 +996,13 @@ drop table t3|
|
|||||||
drop procedure bug2614|
|
drop procedure bug2614|
|
||||||
create function bug2674 () returns int
|
create function bug2674 () returns int
|
||||||
return @@sort_buffer_size|
|
return @@sort_buffer_size|
|
||||||
|
set @osbs = @@sort_buffer_size|
|
||||||
|
set @@sort_buffer_size = 262000|
|
||||||
select bug2674()|
|
select bug2674()|
|
||||||
bug2674()
|
bug2674()
|
||||||
262136
|
262000
|
||||||
drop function bug2674|
|
drop function bug2674|
|
||||||
|
set @@sort_buffer_size = @osbs|
|
||||||
create procedure bug3259_1 () begin end|
|
create procedure bug3259_1 () begin end|
|
||||||
create procedure BUG3259_2 () begin end|
|
create procedure BUG3259_2 () begin end|
|
||||||
create procedure Bug3259_3 () begin end|
|
create procedure Bug3259_3 () begin end|
|
||||||
|
@@ -264,8 +264,8 @@ insert into t1 values (42, 3.1), (19, 1.2)|
|
|||||||
--error 1314
|
--error 1314
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
|
||||||
open c;
|
open c;
|
||||||
fetch c into x, y;
|
fetch c into x, y;
|
||||||
@@ -274,8 +274,8 @@ end|
|
|||||||
|
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
|
||||||
open c;
|
open c;
|
||||||
fetch c into x;
|
fetch c into x;
|
||||||
@@ -287,10 +287,10 @@ drop procedure p|
|
|||||||
|
|
||||||
create procedure p()
|
create procedure p()
|
||||||
begin
|
begin
|
||||||
declare c cursor for select * from t1;
|
|
||||||
declare x int;
|
declare x int;
|
||||||
declare y float;
|
declare y float;
|
||||||
declare z int;
|
declare z int;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
|
||||||
open c;
|
open c;
|
||||||
fetch c into x, y, z;
|
fetch c into x, y, z;
|
||||||
@@ -333,8 +333,30 @@ end|
|
|||||||
# USE is not allowed
|
# USE is not allowed
|
||||||
--error 1323
|
--error 1323
|
||||||
create procedure u()
|
create procedure u()
|
||||||
use sptmp;
|
use sptmp|
|
||||||
|
|
||||||
|
# Enforced standard order of declarations
|
||||||
|
--error 1324
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
declare x int;
|
||||||
|
end|
|
||||||
|
--error 1324
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare x int;
|
||||||
|
declare continue handler for sqlstate '42S99' set x = 1;
|
||||||
|
declare foo condition for sqlstate '42S99';
|
||||||
|
end|
|
||||||
|
|
||||||
|
--error 1325
|
||||||
|
create procedure p()
|
||||||
|
begin
|
||||||
|
declare x int;
|
||||||
|
declare continue handler for sqlstate '42S99' set x = 1;
|
||||||
|
declare c cursor for select * from t1;
|
||||||
|
end|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#1965
|
# BUG#1965
|
||||||
@@ -451,6 +473,33 @@ call bug2329_2()|
|
|||||||
drop procedure bug2329_1|
|
drop procedure bug2329_1|
|
||||||
drop procedure bug2329_2|
|
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|
|
drop table t1|
|
||||||
|
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
|
@@ -776,12 +776,12 @@ drop procedure hndlr4|
|
|||||||
#
|
#
|
||||||
create procedure cur1()
|
create procedure cur1()
|
||||||
begin
|
begin
|
||||||
declare done int default 0;
|
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c cursor for select * from test.t2;
|
|
||||||
declare a char(16);
|
declare a char(16);
|
||||||
declare b int;
|
declare b int;
|
||||||
declare c double;
|
declare c double;
|
||||||
|
declare done int default 0;
|
||||||
|
declare c cursor for select * from test.t2;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
|
|
||||||
open c;
|
open c;
|
||||||
repeat
|
repeat
|
||||||
@@ -806,9 +806,9 @@ create table t3 ( s char(16), i int )|
|
|||||||
create procedure cur2()
|
create procedure cur2()
|
||||||
begin
|
begin
|
||||||
declare done int default 0;
|
declare done int default 0;
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c1 cursor for select id,data from test.t1;
|
declare c1 cursor for select id,data from test.t1;
|
||||||
declare c2 cursor for select i from test.t2;
|
declare c2 cursor for select i from test.t2;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
|
|
||||||
open c1;
|
open c1;
|
||||||
open c2;
|
open c2;
|
||||||
@@ -879,8 +879,8 @@ create procedure modes(out c1 int, out c2 int)
|
|||||||
begin
|
begin
|
||||||
declare done int default 0;
|
declare done int default 0;
|
||||||
declare x int;
|
declare x int;
|
||||||
declare continue handler for sqlstate '02000' set done = 1;
|
|
||||||
declare c cursor for select data from t1;
|
declare c cursor for select data from t1;
|
||||||
|
declare continue handler for sqlstate '02000' set done = 1;
|
||||||
|
|
||||||
select 1 || 2 into c1;
|
select 1 || 2 into c1;
|
||||||
set c2 = 0;
|
set c2 = 0;
|
||||||
@@ -1069,8 +1069,8 @@ drop procedure bug1874|
|
|||||||
create procedure bug2260()
|
create procedure bug2260()
|
||||||
begin
|
begin
|
||||||
declare v1 int;
|
declare v1 int;
|
||||||
declare continue handler for not found set @x2 = 1;
|
|
||||||
declare c1 cursor for select data from t1;
|
declare c1 cursor for select data from t1;
|
||||||
|
declare continue handler for not found set @x2 = 1;
|
||||||
|
|
||||||
open c1;
|
open c1;
|
||||||
fetch c1 into v1;
|
fetch c1 into v1;
|
||||||
@@ -1156,8 +1156,11 @@ drop procedure bug2614|
|
|||||||
create function bug2674 () returns int
|
create function bug2674 () returns int
|
||||||
return @@sort_buffer_size|
|
return @@sort_buffer_size|
|
||||||
|
|
||||||
|
set @osbs = @@sort_buffer_size|
|
||||||
|
set @@sort_buffer_size = 262000|
|
||||||
select bug2674()|
|
select bug2674()|
|
||||||
drop function bug2674|
|
drop function bug2674|
|
||||||
|
set @@sort_buffer_size = @osbs|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#3259
|
# BUG#3259
|
||||||
|
@@ -336,3 +336,6 @@ character-set=latin2
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -338,3 +338,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin7
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -339,3 +339,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=greek
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin2
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=ujis
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=euckr
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin2
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -328,3 +328,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin2
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=koi8r
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -322,3 +322,6 @@ character-set=cp1250
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -335,3 +335,6 @@ character-set=latin2
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
@@ -327,3 +327,6 @@ character-set=latin1
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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,6 @@ character-set=koi8u
|
|||||||
"Failed to ALTER %s %s"
|
"Failed to ALTER %s %s"
|
||||||
"Subselect value not supported"
|
"Subselect value not supported"
|
||||||
"USE is not allowed in a stored procedure"
|
"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"
|
||||||
|
173
sql/sp_head.cc
173
sql/sp_head.cc
@@ -297,6 +297,24 @@ sp_head::create(THD *thd)
|
|||||||
|
|
||||||
DBUG_PRINT("info", ("type: %d name: %s params: %s body: %s",
|
DBUG_PRINT("info", ("type: %d name: %s params: %s body: %s",
|
||||||
m_type, m_name.str, m_params.str, m_body.str));
|
m_type, m_name.str, m_params.str, m_body.str));
|
||||||
|
#ifndef DBUG_OFF
|
||||||
|
String s;
|
||||||
|
sp_instr *i;
|
||||||
|
uint ip= 0;
|
||||||
|
while ((i = get_instr(ip)))
|
||||||
|
{
|
||||||
|
char buf[8];
|
||||||
|
|
||||||
|
sprintf(buf, "%4u: ", ip);
|
||||||
|
s.append(buf);
|
||||||
|
i->print(&s);
|
||||||
|
s.append('\n');
|
||||||
|
ip+= 1;
|
||||||
|
}
|
||||||
|
s.append('\0');
|
||||||
|
DBUG_PRINT("info", ("Code %s\n%s", m_qname.str, s.ptr()));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_type == TYPE_ENUM_FUNCTION)
|
if (m_type == TYPE_ENUM_FUNCTION)
|
||||||
ret= sp_create_function(thd, this);
|
ret= sp_create_function(thd, this);
|
||||||
else
|
else
|
||||||
@@ -622,9 +640,9 @@ sp_head::reset_lex(THD *thd)
|
|||||||
|
|
||||||
(void)m_lex.push_front(oldlex);
|
(void)m_lex.push_front(oldlex);
|
||||||
thd->lex= sublex= new st_lex;
|
thd->lex= sublex= new st_lex;
|
||||||
sublex->yylineno= oldlex->yylineno;
|
|
||||||
/* Reset most stuff. The length arguments doesn't matter here. */
|
/* Reset most stuff. The length arguments doesn't matter here. */
|
||||||
lex_start(thd, oldlex->buf, oldlex->end_of_query - oldlex->ptr);
|
lex_start(thd, oldlex->buf, oldlex->end_of_query - oldlex->ptr);
|
||||||
|
sublex->yylineno= oldlex->yylineno;
|
||||||
/* We must reset ptr and end_of_query again */
|
/* We must reset ptr and end_of_query again */
|
||||||
sublex->ptr= oldlex->ptr;
|
sublex->ptr= oldlex->ptr;
|
||||||
sublex->end_of_query= oldlex->end_of_query;
|
sublex->end_of_query= oldlex->end_of_query;
|
||||||
@@ -871,6 +889,15 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_stmt::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("stmt ");
|
||||||
|
str->qs_append(m_lex->sql_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
|
sp_instr_stmt::exec_stmt(THD *thd, LEX *lex)
|
||||||
{
|
{
|
||||||
@@ -988,6 +1015,16 @@ sp_instr_set::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_set::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("set ");
|
||||||
|
str->qs_append(m_offset);
|
||||||
|
str->append(' ');
|
||||||
|
m_value->print(str);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_jump
|
// sp_instr_jump
|
||||||
//
|
//
|
||||||
@@ -1001,6 +1038,14 @@ sp_instr_jump::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_jump::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("jump ");
|
||||||
|
str->qs_append(m_dest);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_jump_if
|
// sp_instr_jump_if
|
||||||
//
|
//
|
||||||
@@ -1018,6 +1063,16 @@ sp_instr_jump_if::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_jump_if::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("jump_if ");
|
||||||
|
str->qs_append(m_dest);
|
||||||
|
str->append(' ');
|
||||||
|
m_expr->print(str);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_jump_if_not
|
// sp_instr_jump_if_not
|
||||||
//
|
//
|
||||||
@@ -1035,6 +1090,16 @@ sp_instr_jump_if_not::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_jump_if_not::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(16);
|
||||||
|
str->append("jump_if_not ");
|
||||||
|
str->qs_append(m_dest);
|
||||||
|
str->append(' ');
|
||||||
|
m_expr->print(str);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_freturn
|
// sp_instr_freturn
|
||||||
//
|
//
|
||||||
@@ -1047,6 +1112,16 @@ sp_instr_freturn::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_freturn::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("freturn ");
|
||||||
|
str->qs_append(m_type);
|
||||||
|
str->append(' ');
|
||||||
|
m_value->print(str);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_hpush_jump
|
// sp_instr_hpush_jump
|
||||||
//
|
//
|
||||||
@@ -1064,6 +1139,18 @@ sp_instr_hpush_jump::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_hpush_jump::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(32);
|
||||||
|
str->append("hpush_jump ");
|
||||||
|
str->qs_append(m_type);
|
||||||
|
str->append(' ');
|
||||||
|
str->qs_append(m_frame);
|
||||||
|
str->append(' ');
|
||||||
|
str->qs_append(m_handler);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_hpop
|
// sp_instr_hpop
|
||||||
//
|
//
|
||||||
@@ -1076,6 +1163,14 @@ sp_instr_hpop::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_hpop::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("hpop ");
|
||||||
|
str->qs_append(m_count);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_hreturn
|
// sp_instr_hreturn
|
||||||
//
|
//
|
||||||
@@ -1088,6 +1183,14 @@ sp_instr_hreturn::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_hreturn::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("hreturn ");
|
||||||
|
str->qs_append(m_frame);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_cpush
|
// sp_instr_cpush
|
||||||
//
|
//
|
||||||
@@ -1106,6 +1209,12 @@ sp_instr_cpush::~sp_instr_cpush()
|
|||||||
delete m_lex;
|
delete m_lex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_cpush::print(String *str)
|
||||||
|
{
|
||||||
|
str->append("cpush");
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_cpop
|
// sp_instr_cpop
|
||||||
//
|
//
|
||||||
@@ -1118,6 +1227,14 @@ sp_instr_cpop::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_cpop::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("cpop ");
|
||||||
|
str->qs_append(m_count);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_copen
|
// sp_instr_copen
|
||||||
//
|
//
|
||||||
@@ -1145,6 +1262,14 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_copen::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("copen ");
|
||||||
|
str->qs_append(m_cursor);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_cclose
|
// sp_instr_cclose
|
||||||
//
|
//
|
||||||
@@ -1163,6 +1288,14 @@ sp_instr_cclose::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_cclose::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("cclose ");
|
||||||
|
str->qs_append(m_cursor);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// sp_instr_cfetch
|
// sp_instr_cfetch
|
||||||
//
|
//
|
||||||
@@ -1181,6 +1314,44 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_cfetch::print(String *str)
|
||||||
|
{
|
||||||
|
List_iterator_fast<struct sp_pvar> li(m_varlist);
|
||||||
|
sp_pvar_t *pv;
|
||||||
|
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("cfetch ");
|
||||||
|
str->qs_append(m_cursor);
|
||||||
|
while ((pv= li++))
|
||||||
|
{
|
||||||
|
str->reserve(8);
|
||||||
|
str->append(' ');
|
||||||
|
str->qs_append(pv->offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// sp_instr_error
|
||||||
|
//
|
||||||
|
int
|
||||||
|
sp_instr_error::execute(THD *thd, uint *nextp)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("sp_instr_error::execute");
|
||||||
|
|
||||||
|
my_error(m_errcode, MYF(0));
|
||||||
|
*nextp= m_ip+1;
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_error::print(String *str)
|
||||||
|
{
|
||||||
|
str->reserve(12);
|
||||||
|
str->append("error ");
|
||||||
|
str->qs_append(m_errcode);
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -262,12 +262,9 @@ public:
|
|||||||
// instruction to execute. (For most instruction this will be the
|
// instruction to execute. (For most instruction this will be the
|
||||||
// instruction following this one.)
|
// instruction following this one.)
|
||||||
// Returns 0 on success, non-zero if some error occured.
|
// Returns 0 on success, non-zero if some error occured.
|
||||||
virtual int
|
virtual int execute(THD *thd, uint *nextp) = 0;
|
||||||
execute(THD *thd, uint *nextp)
|
|
||||||
{ // Default is a no-op.
|
virtual void print(String *str) = 0;
|
||||||
*nextp = m_ip+1; // Next instruction
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -294,6 +291,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
set_lex(LEX *lex)
|
set_lex(LEX *lex)
|
||||||
{
|
{
|
||||||
@@ -333,6 +332,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_offset; // Frame offset
|
uint m_offset; // Frame offset
|
||||||
@@ -362,6 +363,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
set_destination(uint dest)
|
set_destination(uint dest)
|
||||||
{
|
{
|
||||||
@@ -395,6 +398,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Item *m_expr; // The condition
|
Item *m_expr; // The condition
|
||||||
@@ -422,6 +427,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Item *m_expr; // The condition
|
Item *m_expr; // The condition
|
||||||
@@ -445,6 +452,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Item *m_value;
|
Item *m_value;
|
||||||
@@ -474,6 +483,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
inline void add_condition(struct sp_cond_type *cond)
|
inline void add_condition(struct sp_cond_type *cond)
|
||||||
{
|
{
|
||||||
m_cond.push_front(cond);
|
m_cond.push_front(cond);
|
||||||
@@ -505,6 +516,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_count;
|
uint m_count;
|
||||||
@@ -528,6 +541,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_frame;
|
uint m_frame;
|
||||||
@@ -550,6 +565,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LEX *m_lex;
|
LEX *m_lex;
|
||||||
@@ -573,6 +590,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_count;
|
uint m_count;
|
||||||
@@ -596,6 +615,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_cursor; // Stack index
|
uint m_cursor; // Stack index
|
||||||
@@ -619,6 +640,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint m_cursor;
|
uint m_cursor;
|
||||||
@@ -644,6 +667,8 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
void add_to_varlist(struct sp_pvar *var)
|
void add_to_varlist(struct sp_pvar *var)
|
||||||
{
|
{
|
||||||
m_varlist.push_back(var);
|
m_varlist.push_back(var);
|
||||||
@@ -657,6 +682,31 @@ private:
|
|||||||
}; // class sp_instr_cfetch : public sp_instr
|
}; // class sp_instr_cfetch : public sp_instr
|
||||||
|
|
||||||
|
|
||||||
|
class sp_instr_error : public sp_instr
|
||||||
|
{
|
||||||
|
sp_instr_error(const sp_instr_error &); /* Prevent use of these */
|
||||||
|
void operator=(sp_instr_error &);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
sp_instr_error(uint ip, int errcode)
|
||||||
|
: sp_instr(ip), m_errcode(errcode)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~sp_instr_error()
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
|
virtual void print(String *str);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int m_errcode;
|
||||||
|
|
||||||
|
}; // class sp_instr_error : public sp_instr
|
||||||
|
|
||||||
|
|
||||||
struct st_sp_security_context
|
struct st_sp_security_context
|
||||||
{
|
{
|
||||||
bool changed;
|
bool changed;
|
||||||
|
@@ -698,6 +698,20 @@ void String::qs_append(const char &c)
|
|||||||
str_length += sizeof(c);
|
str_length += sizeof(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void String::qs_append(int i)
|
||||||
|
{
|
||||||
|
char *buff = Ptr + str_length;
|
||||||
|
sprintf(buff,"%d", i);
|
||||||
|
str_length += strlen(buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void String::qs_append(uint i)
|
||||||
|
{
|
||||||
|
char *buff = Ptr + str_length;
|
||||||
|
sprintf(buff,"%u", i);
|
||||||
|
str_length += strlen(buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int sortcmp(const String *x,const String *y, CHARSET_INFO *cs)
|
int sortcmp(const String *x,const String *y, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
|
@@ -270,6 +270,8 @@ public:
|
|||||||
void qs_append(double d);
|
void qs_append(double d);
|
||||||
void qs_append(double *d);
|
void qs_append(double *d);
|
||||||
void qs_append(const char &c);
|
void qs_append(const char &c);
|
||||||
|
void qs_append(int i);
|
||||||
|
void qs_append(uint i);
|
||||||
|
|
||||||
/* Inline (general) functions used by the protocol functions */
|
/* Inline (general) functions used by the protocol functions */
|
||||||
|
|
||||||
|
@@ -1318,6 +1318,20 @@ sp_decls:
|
|||||||
}
|
}
|
||||||
| sp_decls sp_decl ';'
|
| sp_decls sp_decl ';'
|
||||||
{
|
{
|
||||||
|
/* We check for declarations out of (standard) order this way
|
||||||
|
because letting the grammar rules reflect it caused tricky
|
||||||
|
shift/reduce conflicts with the wrong result. (And we get
|
||||||
|
better error handling this way.) */
|
||||||
|
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
|
||||||
|
{ /* Variable or condition following cursor or handler */
|
||||||
|
send_error(YYTHD, ER_SP_VARCOND_AFTER_CURSHNDLR);
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
if ($2.curs && $1.hndlrs)
|
||||||
|
{ /* Cursor following handler */
|
||||||
|
send_error(YYTHD, ER_SP_CURSOR_AFTER_HANDLER);
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
$$.vars= $1.vars + $2.vars;
|
$$.vars= $1.vars + $2.vars;
|
||||||
$$.conds= $1.conds + $2.conds;
|
$$.conds= $1.conds + $2.conds;
|
||||||
$$.hndlrs= $1.hndlrs + $2.hndlrs;
|
$$.hndlrs= $1.hndlrs + $2.hndlrs;
|
||||||
@@ -1894,9 +1908,16 @@ sp_case:
|
|||||||
;
|
;
|
||||||
|
|
||||||
sp_whens:
|
sp_whens:
|
||||||
/* Empty */ {}
|
/* Empty */
|
||||||
| WHEN_SYM sp_case {}
|
{
|
||||||
|
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 {}
|
| ELSE sp_proc_stmts {}
|
||||||
|
| WHEN_SYM sp_case {}
|
||||||
;
|
;
|
||||||
|
|
||||||
sp_labeled_control:
|
sp_labeled_control:
|
||||||
|
Reference in New Issue
Block a user