Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
da44d115
Commit
da44d115
authored
Mar 29, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
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
parents
9bd49d48
329013f9
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
460 additions
and
32 deletions
+460
-32
include/mysqld_error.h
include/mysqld_error.h
+4
-1
include/sql_state.h
include/sql_state.h
+3
-0
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+45
-5
mysql-test/r/sp.result
mysql-test/r/sp.result
+10
-7
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+53
-4
mysql-test/t/sp.test
mysql-test/t/sp.test
+9
-6
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+3
-0
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+3
-0
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+3
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+3
-0
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+3
-0
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+3
-0
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+3
-0
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+3
-0
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+3
-0
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+3
-0
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+3
-0
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+3
-0
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+3
-0
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+3
-0
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+3
-0
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+3
-0
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+3
-0
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+3
-0
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+3
-0
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+3
-0
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+3
-0
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+3
-0
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+3
-0
sql/sp_head.cc
sql/sp_head.cc
+172
-1
sql/sp_head.h
sql/sp_head.h
+56
-6
sql/sql_string.cc
sql/sql_string.cc
+14
-0
sql/sql_string.h
sql/sql_string.h
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+23
-2
No files found.
include/mysqld_error.h
View file @
da44d115
...
...
@@ -340,4 +340,7 @@
#define ER_SP_CANT_ALTER 1321
#define ER_SP_SUBSELECT_NYI 1322
#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
include/sql_state.h
View file @
da44d115
...
...
@@ -197,3 +197,6 @@ ER_SP_DUP_CURS, "42000", "",
/*ER_SP_CANT_ALTER*/
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"
,
""
,
mysql-test/r/sp-error.result
View file @
da44d115
...
...
@@ -194,8 +194,8 @@ create table t1 (val int, x float)|
insert into t1 values (42, 3.1), (19, 1.2)|
create procedure p()
begin
declare c cursor for select * from t1;
declare x int;
declare c cursor for select * from t1;
open c;
fetch c into x, y;
close c;
...
...
@@ -203,8 +203,8 @@ end|
ERROR 42000: Undeclared variable: y
create procedure p()
begin
declare c cursor for select * from t1;
declare x int;
declare c cursor for select * from t1;
open c;
fetch c into x;
close c;
...
...
@@ -214,10 +214,10 @@ ERROR HY000: Wrong number of FETCH variables
drop procedure p|
create procedure p()
begin
declare c cursor for select * from t1;
declare x int;
declare y float;
declare z int;
declare c cursor for select * from t1;
open c;
fetch c into x, y, z;
close c;
...
...
@@ -252,9 +252,28 @@ declare c cursor for select field from t1;
end|
ERROR 42000: Duplicate cursor: c
create procedure u()
use sptmp;
#|
use sptmp|
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()
begin
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'
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|
mysql-test/r/sp.result
View file @
da44d115
...
...
@@ -660,12 +660,12 @@ drop table t3|
drop procedure hndlr4|
create procedure cur1()
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 b int;
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;
repeat
fetch c into a, b, c;
...
...
@@ -688,9 +688,9 @@ create table t3 ( s char(16), i int )|
create procedure cur2()
begin
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 c2 cursor for select i from test.t2;
declare continue handler for sqlstate '02000' set done = 1;
open c1;
open c2;
repeat
...
...
@@ -764,8 +764,8 @@ create procedure modes(out c1 int, out c2 int)
begin
declare done int default 0;
declare x int;
declare continue handler for sqlstate '02000' set done = 1;
declare c cursor for select data from t1;
declare continue handler for sqlstate '02000' set done = 1;
select 1 || 2 into c1;
set c2 = 0;
open c;
...
...
@@ -915,8 +915,8 @@ drop procedure bug1874|
create procedure bug2260()
begin
declare v1 int;
declare continue handler for not found set @x2 = 1;
declare c1 cursor for select data from t1;
declare continue handler for not found set @x2 = 1;
open c1;
fetch c1 into v1;
set @x2 = 2;
...
...
@@ -996,10 +996,13 @@ drop table t3|
drop procedure bug2614|
create function bug2674 () returns int
return @@sort_buffer_size|
set @osbs = @@sort_buffer_size|
set @@sort_buffer_size = 262000|
select bug2674()|
bug2674()
262
136
262
000
drop function bug2674|
set @@sort_buffer_size = @osbs|
create procedure bug3259_1 () begin end|
create procedure BUG3259_2 () begin end|
create procedure Bug3259_3 () begin end|
...
...
mysql-test/t/sp-error.test
View file @
da44d115
...
...
@@ -264,8 +264,8 @@ insert into t1 values (42, 3.1), (19, 1.2)|
--
error
1314
create
procedure
p
()
begin
declare
c
cursor
for
select
*
from
t1
;
declare
x
int
;
declare
c
cursor
for
select
*
from
t1
;
open
c
;
fetch
c
into
x
,
y
;
...
...
@@ -274,8 +274,8 @@ end|
create
procedure
p
()
begin
declare
c
cursor
for
select
*
from
t1
;
declare
x
int
;
declare
c
cursor
for
select
*
from
t1
;
open
c
;
fetch
c
into
x
;
...
...
@@ -287,10 +287,10 @@ drop procedure p|
create
procedure
p
()
begin
declare
c
cursor
for
select
*
from
t1
;
declare
x
int
;
declare
y
float
;
declare
z
int
;
declare
c
cursor
for
select
*
from
t1
;
open
c
;
fetch
c
into
x
,
y
,
z
;
...
...
@@ -333,8 +333,30 @@ end|
# USE is not allowed
--
error
1323
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
...
...
@@ -451,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
;
|
mysql-test/t/sp.test
View file @
da44d115
...
...
@@ -776,12 +776,12 @@ drop procedure hndlr4|
#
create
procedure
cur1
()
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
b
int
;
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
;
repeat
...
...
@@ -806,9 +806,9 @@ create table t3 ( s char(16), i int )|
create
procedure
cur2
()
begin
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
c2
cursor
for
select
i
from
test
.
t2
;
declare
continue
handler
for
sqlstate
'02000'
set
done
=
1
;
open
c1
;
open
c2
;
...
...
@@ -879,8 +879,8 @@ create procedure modes(out c1 int, out c2 int)
begin
declare
done
int
default
0
;
declare
x
int
;
declare
continue
handler
for
sqlstate
'02000'
set
done
=
1
;
declare
c
cursor
for
select
data
from
t1
;
declare
continue
handler
for
sqlstate
'02000'
set
done
=
1
;
select
1
||
2
into
c1
;
set
c2
=
0
;
...
...
@@ -1069,8 +1069,8 @@ drop procedure bug1874|
create
procedure
bug2260
()
begin
declare
v1
int
;
declare
continue
handler
for
not
found
set
@
x2
=
1
;
declare
c1
cursor
for
select
data
from
t1
;
declare
continue
handler
for
not
found
set
@
x2
=
1
;
open
c1
;
fetch
c1
into
v1
;
...
...
@@ -1156,8 +1156,11 @@ drop procedure bug2614|
create
function
bug2674
()
returns
int
return
@@
sort_buffer_size
|
set
@
osbs
=
@@
sort_buffer_size
|
set
@@
sort_buffer_size
=
262000
|
select
bug2674
()
|
drop
function
bug2674
|
set
@@
sort_buffer_size
=
@
osbs
|
#
# BUG#3259
...
...
sql/share/czech/errmsg.txt
View file @
da44d115
...
...
@@ -336,3 +336,6 @@ character-set=latin2
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/danish/errmsg.txt
View file @
da44d115
...
...
@@ -330,3 +330,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/dutch/errmsg.txt
View file @
da44d115
...
...
@@ -338,3 +338,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/english/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/estonian/errmsg.txt
View file @
da44d115
...
...
@@ -332,3 +332,6 @@ character-set=latin7
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/french/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/german/errmsg.txt
View file @
da44d115
...
...
@@ -339,3 +339,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/greek/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=greek
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/hungarian/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=latin2
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/italian/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/japanese/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=ujis
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/korean/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=euckr
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/norwegian-ny/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/norwegian/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/polish/errmsg.txt
View file @
da44d115
...
...
@@ -331,3 +331,6 @@ character-set=latin2
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/portuguese/errmsg.txt
View file @
da44d115
...
...
@@ -328,3 +328,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/romanian/errmsg.txt
View file @
da44d115
...
...
@@ -331,3 +331,6 @@ character-set=latin2
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/russian/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=koi8r
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/serbian/errmsg.txt
View file @
da44d115
...
...
@@ -322,3 +322,6 @@ character-set=cp1250
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/slovak/errmsg.txt
View file @
da44d115
...
...
@@ -335,3 +335,6 @@ character-set=latin2
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/spanish/errmsg.txt
View file @
da44d115
...
...
@@ -329,3 +329,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/swedish/errmsg.txt
View file @
da44d115
...
...
@@ -327,3 +327,6 @@ character-set=latin1
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/share/ukrainian/errmsg.txt
View file @
da44d115
...
...
@@ -332,3 +332,6 @@ character-set=koi8u
"Failed to ALTER %s %s"
"Subselect value not supported"
"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"
sql/sp_head.cc
View file @
da44d115
...
...
@@ -297,6 +297,24 @@ sp_head::create(THD *thd)
DBUG_PRINT
(
"info"
,
(
"type: %d name: %s params: %s body: %s"
,
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
)
ret
=
sp_create_function
(
thd
,
this
);
else
...
...
@@ -622,9 +640,9 @@ sp_head::reset_lex(THD *thd)
(
void
)
m_lex
.
push_front
(
oldlex
);
thd
->
lex
=
sublex
=
new
st_lex
;
sublex
->
yylineno
=
oldlex
->
yylineno
;
/* Reset most stuff. The length arguments doesn't matter here. */
lex_start
(
thd
,
oldlex
->
buf
,
oldlex
->
end_of_query
-
oldlex
->
ptr
);
sublex
->
yylineno
=
oldlex
->
yylineno
;
/* We must reset ptr and end_of_query again */
sublex
->
ptr
=
oldlex
->
ptr
;
sublex
->
end_of_query
=
oldlex
->
end_of_query
;
...
...
@@ -871,6 +889,15 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
res
);
}
void
sp_instr_stmt
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"stmt "
);
str
->
qs_append
(
m_lex
->
sql_command
);
}
int
sp_instr_stmt
::
exec_stmt
(
THD
*
thd
,
LEX
*
lex
)
{
...
...
@@ -988,6 +1015,16 @@ sp_instr_set::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1001,6 +1038,14 @@ sp_instr_jump::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1018,6 +1063,16 @@ sp_instr_jump_if::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1035,6 +1090,16 @@ sp_instr_jump_if_not::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1047,6 +1112,16 @@ sp_instr_freturn::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1064,6 +1139,18 @@ sp_instr_hpush_jump::execute(THD *thd, uint *nextp)
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
//
...
...
@@ -1076,6 +1163,14 @@ sp_instr_hpop::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
0
);
}
void
sp_instr_hpop
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"hpop "
);
str
->
qs_append
(
m_count
);
}
//
// sp_instr_hreturn
//
...
...
@@ -1088,6 +1183,14 @@ sp_instr_hreturn::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
0
);
}
void
sp_instr_hreturn
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"hreturn "
);
str
->
qs_append
(
m_frame
);
}
//
// sp_instr_cpush
//
...
...
@@ -1106,6 +1209,12 @@ sp_instr_cpush::~sp_instr_cpush()
delete
m_lex
;
}
void
sp_instr_cpush
::
print
(
String
*
str
)
{
str
->
append
(
"cpush"
);
}
//
// sp_instr_cpop
//
...
...
@@ -1118,6 +1227,14 @@ sp_instr_cpop::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
0
);
}
void
sp_instr_cpop
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"cpop "
);
str
->
qs_append
(
m_count
);
}
//
// sp_instr_copen
//
...
...
@@ -1145,6 +1262,14 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
res
);
}
void
sp_instr_copen
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"copen "
);
str
->
qs_append
(
m_cursor
);
}
//
// sp_instr_cclose
//
...
...
@@ -1163,6 +1288,14 @@ sp_instr_cclose::execute(THD *thd, uint *nextp)
DBUG_RETURN
(
res
);
}
void
sp_instr_cclose
::
print
(
String
*
str
)
{
str
->
reserve
(
12
);
str
->
append
(
"cclose "
);
str
->
qs_append
(
m_cursor
);
}
//
// sp_instr_cfetch
//
...
...
@@ -1181,6 +1314,44 @@ sp_instr_cfetch::execute(THD *thd, uint *nextp)
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
);
}
/* ------------------------------------------------------------------ */
...
...
sql/sp_head.h
View file @
da44d115
...
...
@@ -262,12 +262,9 @@ public:
// instruction to execute. (For most instruction this will be the
// instruction following this one.)
// Returns 0 on success, non-zero if some error occured.
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
)
{
// Default is a no-op.
*
nextp
=
m_ip
+
1
;
// Next instruction
return
0
;
}
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
)
=
0
;
virtual
void
print
(
String
*
str
)
=
0
;
protected:
...
...
@@ -294,6 +291,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
inline
void
set_lex
(
LEX
*
lex
)
{
...
...
@@ -333,6 +332,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_offset
;
// Frame offset
...
...
@@ -362,6 +363,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
virtual
void
set_destination
(
uint
dest
)
{
...
...
@@ -395,6 +398,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
Item
*
m_expr
;
// The condition
...
...
@@ -422,6 +427,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
Item
*
m_expr
;
// The condition
...
...
@@ -445,6 +452,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
protected:
Item
*
m_value
;
...
...
@@ -474,6 +483,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
inline
void
add_condition
(
struct
sp_cond_type
*
cond
)
{
m_cond
.
push_front
(
cond
);
...
...
@@ -505,6 +516,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_count
;
...
...
@@ -528,6 +541,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_frame
;
...
...
@@ -550,6 +565,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
LEX
*
m_lex
;
...
...
@@ -573,6 +590,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_count
;
...
...
@@ -596,6 +615,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_cursor
;
// Stack index
...
...
@@ -619,6 +640,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
private:
uint
m_cursor
;
...
...
@@ -644,6 +667,8 @@ public:
virtual
int
execute
(
THD
*
thd
,
uint
*
nextp
);
virtual
void
print
(
String
*
str
);
void
add_to_varlist
(
struct
sp_pvar
*
var
)
{
m_varlist
.
push_back
(
var
);
...
...
@@ -657,6 +682,31 @@ private:
};
// 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
{
bool
changed
;
...
...
sql/sql_string.cc
View file @
da44d115
...
...
@@ -698,6 +698,20 @@ void String::qs_append(const char &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
)
{
...
...
sql/sql_string.h
View file @
da44d115
...
...
@@ -270,6 +270,8 @@ public:
void
qs_append
(
double
d
);
void
qs_append
(
double
*
d
);
void
qs_append
(
const
char
&
c
);
void
qs_append
(
int
i
);
void
qs_append
(
uint
i
);
/* Inline (general) functions used by the protocol functions */
...
...
sql/sql_yacc.yy
View file @
da44d115
...
...
@@ -1318,6 +1318,20 @@ sp_decls:
}
| 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;
$$.conds= $1.conds + $2.conds;
$$.hndlrs= $1.hndlrs + $2.hndlrs;
...
...
@@ -1894,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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment