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
781cc33d
Commit
781cc33d
authored
Feb 01, 2006
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/kostja/mysql/mysql-5.0-for_merge2
into mysql.com:/home/kostja/mysql/mysql-5.1-merge
parents
d02215bb
1d83ff5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
47 deletions
+133
-47
mysql-test/r/sp.result
mysql-test/r/sp.result
+55
-19
mysql-test/t/sp.test
mysql-test/t/sp.test
+62
-21
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+16
-7
No files found.
mysql-test/r/sp.result
View file @
781cc33d
...
...
@@ -3554,8 +3554,6 @@ drop procedure if exists bug7049_1|
drop procedure if exists bug7049_2|
drop procedure if exists bug7049_3|
drop procedure if exists bug7049_4|
drop procedure if exists bug7049_5|
drop procedure if exists bug7049_6|
drop function if exists bug7049_1|
drop function if exists bug7049_2|
create table t3 ( x int unique )|
...
...
@@ -3580,18 +3578,6 @@ select 'Caught it' as 'Result';
call bug7049_3();
select 'Missed it' as 'Result';
end|
create procedure bug7049_5()
begin
declare x decimal(2,1);
set x = 'zap';
end|
create procedure bug7049_6()
begin
declare exit handler for sqlwarning
select 'Caught it' as 'Result';
call bug7049_5();
select 'Missed it' as 'Result';
end|
create function bug7049_1()
returns int
begin
...
...
@@ -3621,9 +3607,6 @@ Caught it
select * from t3|
x
42
call bug7049_6()|
Result
Caught it
select bug7049_2()|
bug7049_2()
1
...
...
@@ -3632,8 +3615,6 @@ drop procedure bug7049_1|
drop procedure bug7049_2|
drop procedure bug7049_3|
drop procedure bug7049_4|
drop procedure bug7049_5|
drop procedure bug7049_6|
drop function bug7049_1|
drop function bug7049_2|
drop function if exists bug13941|
...
...
@@ -4315,4 +4296,59 @@ id county
2 NULL
drop table t3|
drop procedure bug15441|
drop table if exists t3|
drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
create table t3 (id int not null)|
create procedure bug15231_1()
begin
declare xid integer;
declare xdone integer default 0;
declare continue handler for not found set xdone = 1;
set xid=null;
call bug15231_2(xid);
select xid, xdone;
end|
create procedure bug15231_2(inout ioid integer)
begin
select "Before NOT FOUND condition is triggered" as '1';
select id into ioid from t3 where id=ioid;
select "After NOT FOUND condtition is triggered" as '2';
if ioid is null then
set ioid=1;
end if;
end|
create procedure bug15231_3()
begin
declare exit handler for sqlwarning
select 'Caught it (wrong)' as 'Result';
call bug15231_4();
end|
create procedure bug15231_4()
begin
declare x decimal(2,1);
set x = 'zap';
select 'Missed it (correct)' as 'Result';
end|
call bug15231_1()|
1
Before NOT FOUND condition is triggered
2
After NOT FOUND condtition is triggered
xid xdone
1 0
Warnings:
Warning 1329 No data to FETCH
call bug15231_3()|
Result
Missed it (correct)
Warnings:
Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
drop table if exists t3|
drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
drop table t1,t2;
mysql-test/t/sp.test
View file @
781cc33d
...
...
@@ -4297,8 +4297,6 @@ drop procedure if exists bug7049_1|
drop procedure if exists bug7049_2|
drop procedure if exists bug7049_3|
drop procedure if exists bug7049_4|
drop procedure if exists bug7049_5|
drop procedure if exists bug7049_6|
drop function if exists bug7049_1|
drop function if exists bug7049_2|
--enable_warnings
...
...
@@ -4332,22 +4330,6 @@ begin
select 'Missed it' as 'Result';
end|
create procedure bug7049_5()
begin
declare x decimal(2,1);
set x = 'zap';
end|
create procedure bug7049_6()
begin
declare exit handler for sqlwarning
select 'Caught it' as 'Result';
call bug7049_5();
select 'Missed it' as 'Result';
end|
create function bug7049_1()
returns int
begin
...
...
@@ -4372,7 +4354,6 @@ select * from t3|
delete from t3|
call bug7049_4()|
select * from t3|
call bug7049_6()|
select bug7049_2()|
drop table t3|
...
...
@@ -4380,8 +4361,6 @@ drop procedure bug7049_1|
drop procedure bug7049_2|
drop procedure bug7049_3|
drop procedure bug7049_4|
drop procedure bug7049_5|
drop procedure bug7049_6|
drop function bug7049_1|
drop function bug7049_2|
...
...
@@ -5069,6 +5048,68 @@ call bug15441('Yale')|
drop
table
t3
|
drop
procedure
bug15441
|
#
# BUG#15231: Stored procedure bug with not found condition handler
#
--
disable_warnings
drop
table
if
exists
t3
|
drop
procedure
if
exists
bug15231_1
|
drop
procedure
if
exists
bug15231_2
|
drop
procedure
if
exists
bug15231_3
|
drop
procedure
if
exists
bug15231_4
|
--
enable_warnings
create
table
t3
(
id
int
not
null
)
|
create
procedure
bug15231_1
()
begin
declare
xid
integer
;
declare
xdone
integer
default
0
;
declare
continue
handler
for
not
found
set
xdone
=
1
;
set
xid
=
null
;
call
bug15231_2
(
xid
);
select
xid
,
xdone
;
end
|
create
procedure
bug15231_2
(
inout
ioid
integer
)
begin
select
"Before NOT FOUND condition is triggered"
as
'1'
;
select
id
into
ioid
from
t3
where
id
=
ioid
;
select
"After NOT FOUND condtition is triggered"
as
'2'
;
if
ioid
is
null
then
set
ioid
=
1
;
end
if
;
end
|
create
procedure
bug15231_3
()
begin
declare
exit
handler
for
sqlwarning
select
'Caught it (wrong)'
as
'Result'
;
call
bug15231_4
();
end
|
create
procedure
bug15231_4
()
begin
declare
x
decimal
(
2
,
1
);
set
x
=
'zap'
;
select
'Missed it (correct)'
as
'Result'
;
end
|
call
bug15231_1
()
|
call
bug15231_3
()
|
drop
table
if
exists
t3
|
drop
procedure
if
exists
bug15231_1
|
drop
procedure
if
exists
bug15231_2
|
drop
procedure
if
exists
bug15231_3
|
drop
procedure
if
exists
bug15231_4
|
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/sp_rcontext.cc
View file @
781cc33d
...
...
@@ -160,6 +160,10 @@ sp_rcontext::set_return_value(THD *thd, Item *return_value_item)
}
#define IS_WARNING_CONDITION(S) ((S)[0] == '0' && (S)[1] == '1')
#define IS_NOT_FOUND_CONDITION(S) ((S)[0] == '0' && (S)[1] == '2')
#define IS_EXCEPTION_CONDITION(S) ((S)[0] != '0' || (S)[1] > '2')
bool
sp_rcontext
::
find_handler
(
uint
sql_errno
,
MYSQL_ERROR
::
enum_warning_level
level
)
...
...
@@ -193,18 +197,17 @@ sp_rcontext::find_handler(uint sql_errno,
found
=
i
;
break
;
case
sp_cond_type_t
:
:
warning
:
if
((
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
1
]
==
'1'
||
level
==
MYSQL_ERROR
::
WARN_LEVEL_WARN
)
&&
found
<
0
)
if
((
IS_WARNING_CONDITION
(
sqlstate
)
||
level
==
MYSQL_ERROR
::
WARN_LEVEL_WARN
)
&&
found
<
0
)
found
=
i
;
break
;
case
sp_cond_type_t
:
:
notfound
:
if
(
sqlstate
[
0
]
==
'0'
&&
sqlstate
[
1
]
==
'2'
&&
found
<
0
)
if
(
IS_NOT_FOUND_CONDITION
(
sqlstate
)
&&
found
<
0
)
found
=
i
;
break
;
case
sp_cond_type_t
:
:
exception
:
if
(
(
sqlstate
[
0
]
!=
'0'
||
sqlstate
[
1
]
>
'2'
)
&&
if
(
IS_EXCEPTION_CONDITION
(
sqlstate
)
&&
level
==
MYSQL_ERROR
::
WARN_LEVEL_ERROR
&&
found
<
0
)
found
=
i
;
...
...
@@ -213,7 +216,13 @@ sp_rcontext::find_handler(uint sql_errno,
}
if
(
found
<
0
)
{
if
(
m_prev_runtime_ctx
)
/*
Only "exception conditions" are propagated to handlers in calling
contexts. If no handler is found locally for a "completion condition"
(warning or "not found") we will simply resume execution.
*/
if
(
m_prev_runtime_ctx
&&
IS_EXCEPTION_CONDITION
(
sqlstate
)
&&
level
==
MYSQL_ERROR
::
WARN_LEVEL_ERROR
)
return
m_prev_runtime_ctx
->
find_handler
(
sql_errno
,
level
);
return
FALSE
;
}
...
...
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