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
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
Hide 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
...
@@ -514,21 +514,21 @@ id data
hndlr3 13
hndlr3 13
delete from t1;
delete from t1;
drop procedure hndlr3;
drop procedure hndlr3;
drop table if exists t3;
create table t3 ( id char(16), data int );
create procedure hndlr4()
create procedure hndlr4()
begin
begin
declare x int default 0;
declare x int default 0;
declare val int; # No default
declare val int; # No default
declare continue handler for sqlexception set x=1;
declare continue handler for sqlexception set x=1;
select data into val from test.t1 where id='z' limit 1; # No hits
select data into val from test.t3 where id='z' limit 1; # No hits
if val < 10 then
insert into test.t3 values ('z', val);
insert into test.t1 values ('z', 10);
end if;
end;
end;
call hndlr4();
call hndlr4();
select * from t
1
;
select * from t
3
;
id data
id data
z
10
z
NULL
d
elete from t1
;
d
rop table t3
;
drop procedure hndlr4;
drop procedure hndlr4;
create procedure cur1()
create procedure cur1()
begin
begin
...
@@ -555,6 +555,7 @@ foo 40
...
@@ -555,6 +555,7 @@ foo 40
bar 15
bar 15
zap 663
zap 663
drop procedure cur1;
drop procedure cur1;
drop table if exists t3;
create table t3 ( s char(16), i int );
create table t3 ( s char(16), i int );
create procedure cur2()
create procedure cur2()
begin
begin
...
...
mysql-test/t/sp.test
View file @
52dae5c7
...
@@ -608,22 +608,25 @@ drop procedure hndlr3|
...
@@ -608,22 +608,25 @@ drop procedure hndlr3|
# Variables might be uninitialized when using handlers
# Variables might be uninitialized when using handlers
# (Otherwise the compiler can detect if a variable is not set, but
# (Otherwise the compiler can detect if a variable is not set, but
# not in this case.)
# not in this case.)
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
id
char
(
16
),
data
int
)
|
create
procedure
hndlr4
()
create
procedure
hndlr4
()
begin
begin
declare
x
int
default
0
;
declare
x
int
default
0
;
declare
val
int
;
# No default
declare
val
int
;
# No default
declare
continue
handler
for
sqlexception
set
x
=
1
;
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
.
t3
values
(
'z'
,
val
);
insert
into
test
.
t1
values
(
'z'
,
10
);
end
if
;
end
|
end
|
call
hndlr4
()
|
call
hndlr4
()
|
select
*
from
t
1
|
select
*
from
t
3
|
d
elete
from
t1
|
d
rop
table
t3
|
drop
procedure
hndlr4
|
drop
procedure
hndlr4
|
...
@@ -654,6 +657,9 @@ call cur1()|
...
@@ -654,6 +657,9 @@ call cur1()|
select
*
from
t1
|
select
*
from
t1
|
drop
procedure
cur1
|
drop
procedure
cur1
|
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
s
char
(
16
),
i
int
)
|
create
table
t3
(
s
char
(
16
),
i
int
)
|
create
procedure
cur2
()
create
procedure
cur2
()
...
...
sql/item.h
View file @
52dae5c7
...
@@ -278,6 +278,10 @@ public:
...
@@ -278,6 +278,10 @@ public:
return
FALSE
;
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)
...
@@ -316,9 +316,17 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
// The rest of the frame are local variables which are all IN.
// 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
for
(;
i
<
csize
;
i
++
)
// be set by an set instruction).
nctx
->
push_item
(
NULL
);
{
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
;
thd
->
spcont
=
nctx
;
ret
=
execute
(
thd
);
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