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
52dae5c7
Commit
52dae5c7
authored
Oct 20, 2003
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix; added another method to Item_splocal, updated tests, and added previous
fix to functions as well.
parent
98397562
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
16 deletions
+35
-16
mysql-test/r/sp.result
mysql-test/r/sp.result
+8
-7
mysql-test/t/sp.test
mysql-test/t/sp.test
+12
-6
sql/item.h
sql/item.h
+4
-0
sql/sp_head.cc
sql/sp_head.cc
+11
-3
No files found.
mysql-test/r/sp.result
View file @
52dae5c7
...
...
@@ -514,21 +514,21 @@ id data
hndlr3 13
delete from t1;
drop procedure hndlr3;
drop table if exists t3;
create table t3 ( id char(16), data int );
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;
select data into val from test.t3 where id='z' limit 1; # No hits
insert into test.t3 values ('z', val);
end;
call hndlr4();
select * from t
1
;
select * from t
3
;
id data
z
10
d
elete from t1
;
z
NULL
d
rop table t3
;
drop procedure hndlr4;
create procedure cur1()
begin
...
...
@@ -555,6 +555,7 @@ foo 40
bar 15
zap 663
drop procedure cur1;
drop table if exists t3;
create table t3 ( s char(16), i int );
create procedure cur2()
begin
...
...
mysql-test/t/sp.test
View file @
52dae5c7
...
...
@@ -608,22 +608,25 @@ 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.)
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
id
char
(
16
),
data
int
)
|
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
.
t
1
where
id
=
'z'
limit
1
;
# No hits
select
data
into
val
from
test
.
t
3
where
id
=
'z'
limit
1
;
# No hits
if
val
<
10
then
insert
into
test
.
t1
values
(
'z'
,
10
);
end
if
;
insert
into
test
.
t3
values
(
'z'
,
val
);
end
|
call
hndlr4
()
|
select
*
from
t
1
|
d
elete
from
t1
|
select
*
from
t
3
|
d
rop
table
t3
|
drop
procedure
hndlr4
|
...
...
@@ -654,6 +657,9 @@ call cur1()|
select
*
from
t1
|
drop
procedure
cur1
|
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
s
char
(
16
),
i
int
)
|
create
procedure
cur2
()
...
...
sql/item.h
View file @
52dae5c7
...
...
@@ -278,6 +278,10 @@ class Item_splocal : public Item
return
FALSE
;
}
inline
int
save_in_field
(
Field
*
field
,
bool
no_conversions
)
{
return
this_item
()
->
save_in_field
(
field
,
no_conversions
);
}
};
...
...
sql/sp_head.cc
View file @
52dae5c7
...
...
@@ -316,9 +316,17 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
close_thread_tables
(
thd
);
// The rest of the frame are local variables which are all IN.
// QQ See comment in execute_procedure below.
// 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
;
ret
=
execute
(
thd
);
...
...
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