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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e04f4fb4
Commit
e04f4fb4
authored
Sep 02, 2004
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed BUG#5307: Stored procedure allows statement after BEGIN ... END.
parent
fee115ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
mysql-test/r/sp.result
mysql-test/r/sp.result
+8
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+12
-0
sql/sp_head.cc
sql/sp_head.cc
+11
-2
No files found.
mysql-test/r/sp.result
View file @
e04f4fb4
...
...
@@ -1776,6 +1776,14 @@ end loop;
end|
call bug5287(1)|
drop procedure bug5287|
create procedure bug5307()
begin
end; set @x = 3|
call bug5307()|
select @x|
@x
3
drop procedure bug5307|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
...
...
mysql-test/t/sp.test
View file @
e04f4fb4
...
...
@@ -1942,6 +1942,18 @@ call bug5287(1)|
drop
procedure
bug5287
|
#
# BUG#5307: Stored procedure allows statement after BEGIN ... END
#
create
procedure
bug5307
()
begin
end
;
set
@
x
=
3
|
call
bug5307
()
|
select
@
x
|
drop
procedure
bug5307
|
#
# Some "real" examples
#
...
...
sql/sp_head.cc
View file @
e04f4fb4
...
...
@@ -288,6 +288,7 @@ void
sp_head
::
init_strings
(
THD
*
thd
,
LEX
*
lex
,
sp_name
*
name
)
{
DBUG_ENTER
(
"sp_head::init_strings"
);
uint
n
;
/* Counter for nul trimming */
/* During parsing, we must use thd->mem_root */
MEM_ROOT
*
root
=
&
thd
->
mem_root
;
...
...
@@ -351,9 +352,17 @@ sp_head::init_strings(THD *thd, LEX *lex, sp_name *name)
(
char
*
)
m_returns_begin
,
m_retstr
.
length
);
}
}
m_body
.
length
=
lex
->
end_of_query
-
m_body_begin
;
m_body
.
length
=
lex
->
ptr
-
m_body_begin
;
/* Trim nuls at the end */
n
=
0
;
while
(
m_body
.
length
&&
m_body_begin
[
m_body
.
length
-
1
]
==
'\0'
)
{
m_body
.
length
-=
1
;
n
+=
1
;
}
m_body
.
str
=
strmake_root
(
root
,
(
char
*
)
m_body_begin
,
m_body
.
length
);
m_defstr
.
length
=
lex
->
end_of_query
-
lex
->
buf
;
m_defstr
.
length
=
lex
->
ptr
-
lex
->
buf
;
m_defstr
.
length
-=
n
;
m_defstr
.
str
=
strmake_root
(
root
,
(
char
*
)
lex
->
buf
,
m_defstr
.
length
);
DBUG_VOID_RETURN
;
}
...
...
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