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
98397562
Commit
98397562
authored
Oct 17, 2003
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Local variables are now initialized to null.
parent
1f1a8531
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
6 deletions
+53
-6
mysql-test/r/sp.result
mysql-test/r/sp.result
+16
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+23
-0
sql/item.h
sql/item.h
+3
-1
sql/sp_head.cc
sql/sp_head.cc
+11
-5
No files found.
mysql-test/r/sp.result
View file @
98397562
...
...
@@ -514,6 +514,22 @@ id data
hndlr3 13
delete from t1;
drop procedure hndlr3;
create procedure hndlr4()
begin
declare x int default 0;
declare val int; # No default
declare continue handler for sqlexception set x=1;
select data into val from test.t1 where id='z' limit 1; # No hits
if val < 10 then
insert into test.t1 values ('z', 10);
end if;
end;
call hndlr4();
select * from t1;
id data
z 10
delete from t1;
drop procedure hndlr4;
create procedure cur1()
begin
declare done int default 0;
...
...
mysql-test/t/sp.test
View file @
98397562
...
...
@@ -604,6 +604,29 @@ select * from t1|
delete
from
t1
|
drop
procedure
hndlr3
|
# Variables might be uninitialized when using handlers
# (Otherwise the compiler can detect if a variable is not set, but
# not in this case.)
create
procedure
hndlr4
()
begin
declare
x
int
default
0
;
declare
val
int
;
# No default
declare
continue
handler
for
sqlexception
set
x
=
1
;
select
data
into
val
from
test
.
t1
where
id
=
'z'
limit
1
;
# No hits
if
val
<
10
then
insert
into
test
.
t1
values
(
'z'
,
10
);
end
if
;
end
|
call
hndlr4
()
|
select
*
from
t1
|
delete
from
t1
|
drop
procedure
hndlr4
|
#
# Cursors
#
...
...
sql/item.h
View file @
98397562
...
...
@@ -229,7 +229,9 @@ class Item_splocal : public Item
Item_splocal
(
uint
offset
)
:
m_offset
(
offset
)
{}
{
Item
::
maybe_null
=
TRUE
;
}
Item
*
this_item
();
Item
*
this_const_item
()
const
;
...
...
sql/sp_head.cc
View file @
98397562
...
...
@@ -401,11 +401,17 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
close_thread_tables
(
thd
);
// The rest of the frame are local variables which are all IN.
// QQ We haven't found any hint of what the value is when unassigned,
// so we set it to NULL for now. It's an error to refer to an
// unassigned variable anyway (which should be detected by the parser).
// 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
++
)
nctx
->
push_item
(
NULL
);
{
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