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
bfe6ef9c
Commit
bfe6ef9c
authored
Oct 28, 2003
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix BUG#1656: Have to initialize OUT parameters too, in case they're not
later set by the procedure.
parent
be26021b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
8 deletions
+38
-8
mysql-test/r/sp.result
mysql-test/r/sp.result
+11
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+17
-0
sql/sp_head.cc
sql/sp_head.cc
+10
-8
No files found.
mysql-test/r/sp.result
View file @
bfe6ef9c
...
...
@@ -653,6 +653,17 @@ less 2
more 17
delete from t1;
drop procedure bug1547;
drop table if exists t70;
create table t70 (s1 int,s2 int);
insert into t70 values (1,2);
create procedure bug1656(out p1 int, out p2 int)
select * into p1, p1 from t70;
call bug1656(@1, @2);
select @1, @2;
@1 @2
2 NULL
drop table t70;
drop procedure bug1656;
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 @
bfe6ef9c
...
...
@@ -764,6 +764,23 @@ select * from t1|
delete
from
t1
|
drop
procedure
bug1547
|
#
# BUG#1656
#
--
disable_warnings
drop
table
if
exists
t70
|
--
enable_warnings
create
table
t70
(
s1
int
,
s2
int
)
|
insert
into
t70
values
(
1
,
2
)
|
create
procedure
bug1656
(
out
p1
int
,
out
p2
int
)
select
*
into
p1
,
p1
from
t70
|
call
bug1656
(
@
1
,
@
2
)
|
select
@
1
,
@
2
|
drop
table
t70
|
drop
procedure
bug1656
|
#
# Some "real" examples
...
...
sql/sp_head.cc
View file @
bfe6ef9c
...
...
@@ -373,6 +373,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if
(
csize
>
0
||
hmax
>
0
||
cmax
>
0
)
{
Item_null
*
nit
=
NULL
;
// Re-use this, and only create if needed
uint
i
;
List_iterator_fast
<
Item
>
li
(
*
args
);
Item
*
it
;
...
...
@@ -393,7 +394,11 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
else
{
if
(
pvar
->
mode
==
sp_param_out
)
nctx
->
push_item
(
NULL
);
// OUT
{
if
(
!
nit
)
nit
=
new
Item_null
();
nctx
->
push_item
(
nit
);
// OUT
}
else
nctx
->
push_item
(
sp_eval_func_item
(
thd
,
it
,
pvar
->
type
));
// IN or INOUT
// Note: If it's OUT or INOUT, it must be a variable.
...
...
@@ -411,15 +416,12 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
// The rest of the frame are local variables which are all IN.
// Default all variables to null (those with default clauses will
// be set by an set instruction).
{
Item_null
*
nit
=
NULL
;
// Re-use this, and only create if needed
for
(;
i
<
csize
;
i
++
)
{
if
(
!
nit
)
nit
=
new
Item_null
();
nctx
->
push_item
(
nit
);
}
}
thd
->
spcont
=
nctx
;
}
...
...
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