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
f5035faf
Commit
f5035faf
authored
Feb 15, 2006
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional tests for nested handlers added to sp.test.
A follow-up to BUG#15011 (already fixed).
parent
d67b0a6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
725 additions
and
3 deletions
+725
-3
mysql-test/r/sp.result
mysql-test/r/sp.result
+333
-2
mysql-test/t/sp.test
mysql-test/t/sp.test
+392
-1
No files found.
mysql-test/r/sp.result
View file @
f5035faf
...
@@ -1413,8 +1413,6 @@ select `foo` ()|
...
@@ -1413,8 +1413,6 @@ select `foo` ()|
5
5
drop function `foo`|
drop function `foo`|
drop function if exists t1max|
drop function if exists t1max|
Warnings:
Note 1305 FUNCTION t1max does not exist
create function t1max() returns int
create function t1max() returns int
begin
begin
declare x int;
declare x int;
...
@@ -1470,6 +1468,339 @@ zip 3
...
@@ -1470,6 +1468,339 @@ zip 3
foo 1
foo 1
drop table t3|
drop table t3|
drop function getcount|
drop function getcount|
drop table if exists t3|
drop procedure if exists h_ee|
drop procedure if exists h_es|
drop procedure if exists h_en|
drop procedure if exists h_ew|
drop procedure if exists h_ex|
drop procedure if exists h_se|
drop procedure if exists h_ss|
drop procedure if exists h_sn|
drop procedure if exists h_sw|
drop procedure if exists h_sx|
drop procedure if exists h_ne|
drop procedure if exists h_ns|
drop procedure if exists h_nn|
drop procedure if exists h_we|
drop procedure if exists h_ws|
drop procedure if exists h_ww|
drop procedure if exists h_xe|
drop procedure if exists h_xs|
drop procedure if exists h_xx|
create table t3 (a smallint primary key)|
insert into t3 (a) values (1)|
create procedure h_ee()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (bad)' as 'h_ee';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_ee';
insert into t3 values (1);
end;
end|
create procedure h_es()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_es';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (bad)' as 'h_es';
insert into t3 values (1);
end;
end|
create procedure h_en()
deterministic
begin
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Outer (good)' as 'h_en';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (bad)' as 'h_en';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ew()
deterministic
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Outer (good)' as 'h_ew';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_ew';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ex()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_ex';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_ex';
insert into t3 values (1);
end;
end|
create procedure h_se()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_se';
insert into t3 values (1);
end;
end|
create procedure h_ss()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_ss';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_ss';
insert into t3 values (1);
end;
end|
create procedure h_sn()
deterministic
begin
-- Note: '02000' is more specific than NOT FOUND ;
-- there might be other not found states
declare continue handler for sqlstate '02000' -- no data
select 'Outer (good)' as 'h_sn';
begin
declare x int;
declare continue handler for not found
select 'Inner (bad)' as 'h_sn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_sw()
deterministic
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Outer (good)' as 'h_sw';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_sw';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_sx()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (good)' as 'h_sx';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_sx';
insert into t3 values (1);
end;
end|
create procedure h_ne()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ne';
begin
declare x int;
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Inner (good)' as 'h_ne';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ns()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ns';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (good)' as 'h_ns';
select a into x from t3 where a = 42;
end;
end|
create procedure h_nn()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_nn';
begin
declare x int;
declare continue handler for not found
select 'Inner (good)' as 'h_nn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_we()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_we';
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Inner (good)' as 'h_we';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ws()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ws';
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Inner (good)' as 'h_ws';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ww()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ww';
begin
declare continue handler for sqlwarning
select 'Inner (good)' as 'h_ww';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_xe()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xe';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_xe';
insert into t3 values (1);
end;
end|
create procedure h_xs()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xs';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_xs';
insert into t3 values (1);
end;
end|
create procedure h_xx()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xx';
begin
declare continue handler for sqlexception
select 'Inner (good)' as 'h_xx';
insert into t3 values (1);
end;
end|
call h_ee()|
h_ee
Inner (good)
call h_es()|
h_es
Outer (good)
call h_en()|
h_en
Outer (good)
call h_ew()|
h_ew
Outer (good)
call h_ex()|
h_ex
Outer (good)
call h_se()|
h_se
Inner (good)
call h_ss()|
h_ss
Inner (good)
call h_sn()|
h_sn
Outer (good)
call h_sw()|
h_sw
Outer (good)
call h_sx()|
h_sx
Outer (good)
call h_ne()|
h_ne
Inner (good)
call h_ns()|
h_ns
Inner (good)
call h_nn()|
h_nn
Inner (good)
call h_we()|
h_we
Inner (good)
call h_ws()|
h_ws
Inner (good)
call h_ww()|
h_ww
Inner (good)
call h_xe()|
h_xe
Inner (good)
call h_xs()|
h_xs
Inner (good)
call h_xx()|
h_xx
Inner (good)
drop table t3|
drop procedure h_ee|
drop procedure h_es|
drop procedure h_en|
drop procedure h_ew|
drop procedure h_ex|
drop procedure h_se|
drop procedure h_ss|
drop procedure h_sn|
drop procedure h_sw|
drop procedure h_sx|
drop procedure h_ne|
drop procedure h_ns|
drop procedure h_nn|
drop procedure h_we|
drop procedure h_ws|
drop procedure h_ww|
drop procedure h_xe|
drop procedure h_xs|
drop procedure h_xx|
drop procedure if exists bug822|
drop procedure if exists bug822|
create procedure bug822(a_id char(16), a_data int)
create procedure bug822(a_id char(16), a_data int)
begin
begin
...
...
mysql-test/t/sp.test
View file @
f5035faf
...
@@ -1660,7 +1660,7 @@ drop function `foo`|
...
@@ -1660,7 +1660,7 @@ drop function `foo`|
# Implicit LOCK/UNLOCK TABLES for table access in functions
# Implicit LOCK/UNLOCK TABLES for table access in functions
#
#
--disable_warning
--disable_warning
s
drop function if exists t1max|
drop function if exists t1max|
--enable_warnings
--enable_warnings
create function t1max() returns int
create function t1max() returns int
...
@@ -1704,6 +1704,397 @@ drop table t3|
...
@@ -1704,6 +1704,397 @@ drop table t3|
drop function getcount|
drop function getcount|
# Test cases for different combinations of condition handlers in nested
# begin-end blocks in stored procedures.
#
# Note that the standard specifies that the most specific handler should
# be triggered even if it's an outer handler masked by a less specific
# handler in an inner block.
# Note also that '02000' is more specific than NOT FOUND; there might be
# other '02xxx' states, even if we currently do not issue them in any
# situation (e.g. '02001').
#
# The combinations we test are these:
#
# Inner
# errcode sqlstate not found sqlwarning sqlexception
# Outer +------------+------------+------------+------------+------------+
#errcode | h_ee (i) | h_es (o) | h_en (o) | h_ew (o) | h_ex (o) |
#sqlstate | h_se (i) | h_ss (i) | h_sn (o) | h_sw (o) | h_sx (o) |
#not found | h_ne (i) | h_ns (i) | h_nn (i) | | |
#sqlwarning | h_we (i) | h_ws (i) | | h_ww (i) | |
#sqlexception | h_xe (i) | h_xs (i) | | | h_xx (i) |
# +------------+---------------------------------------------------+
#
# (i) means that the inner handler is the one that should be invoked,
# (o) means that the outer handler should be invoked.
#
# ('not found', 'sqlwarning' and 'sqlexception' are mutually exclusive, hence
# no tests for those combinations.)
#
--disable_warnings
drop table if exists t3|
drop procedure if exists h_ee|
drop procedure if exists h_es|
drop procedure if exists h_en|
drop procedure if exists h_ew|
drop procedure if exists h_ex|
drop procedure if exists h_se|
drop procedure if exists h_ss|
drop procedure if exists h_sn|
drop procedure if exists h_sw|
drop procedure if exists h_sx|
drop procedure if exists h_ne|
drop procedure if exists h_ns|
drop procedure if exists h_nn|
drop procedure if exists h_we|
drop procedure if exists h_ws|
drop procedure if exists h_ww|
drop procedure if exists h_xe|
drop procedure if exists h_xs|
drop procedure if exists h_xx|
--enable_warnings
# smallint - to get out of range warnings
# primary key - to get constraint errors
create table t3 (a smallint primary key)|
insert into t3 (a) values (1)|
create procedure h_ee()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (bad)' as 'h_ee';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_ee';
insert into t3 values (1);
end;
end|
create procedure h_es()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_es';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (bad)' as 'h_es';
insert into t3 values (1);
end;
end|
create procedure h_en()
deterministic
begin
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Outer (good)' as 'h_en';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (bad)' as 'h_en';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ew()
deterministic
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Outer (good)' as 'h_ew';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_ew';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ex()
deterministic
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Outer (good)' as 'h_ex';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_ex';
insert into t3 values (1);
end;
end|
create procedure h_se()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_se';
insert into t3 values (1);
end;
end|
create procedure h_ss()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_ss';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_ss';
insert into t3 values (1);
end;
end|
create procedure h_sn()
deterministic
begin
-- Note: '02000' is more specific than NOT FOUND ;
-- there might be other not found states
declare continue handler for sqlstate '02000' -- no data
select 'Outer (good)' as 'h_sn';
begin
declare x int;
declare continue handler for not found
select 'Inner (bad)' as 'h_sn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_sw()
deterministic
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Outer (good)' as 'h_sw';
begin
declare continue handler for sqlwarning
select 'Inner (bad)' as 'h_sw';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_sx()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Outer (good)' as 'h_sx';
begin
declare continue handler for sqlexception
select 'Inner (bad)' as 'h_sx';
insert into t3 values (1);
end;
end|
create procedure h_ne()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ne';
begin
declare x int;
declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
select 'Inner (good)' as 'h_ne';
select a into x from t3 where a = 42;
end;
end|
create procedure h_ns()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_ns';
begin
declare x int;
declare continue handler for sqlstate '02000' -- no data
select 'Inner (good)' as 'h_ns';
select a into x from t3 where a = 42;
end;
end|
create procedure h_nn()
deterministic
begin
declare continue handler for not found
select 'Outer (bad)' as 'h_nn';
begin
declare x int;
declare continue handler for not found
select 'Inner (good)' as 'h_nn';
select a into x from t3 where a = 42;
end;
end|
create procedure h_we()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_we';
begin
declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
select 'Inner (good)' as 'h_we';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ws()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ws';
begin
-- data exception - numeric value out of range
declare continue handler for sqlstate '22003'
select 'Inner (good)' as 'h_ws';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_ww()
deterministic
begin
declare continue handler for sqlwarning
select 'Outer (bad)' as 'h_ww';
begin
declare continue handler for sqlwarning
select 'Inner (good)' as 'h_ww';
insert into t3 values (123456789012);
end;
delete from t3;
insert into t3 values (1);
end|
create procedure h_xe()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xe';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
select 'Inner (good)' as 'h_xe';
insert into t3 values (1);
end;
end|
create procedure h_xs()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xs';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_xs';
insert into t3 values (1);
end;
end|
create procedure h_xx()
deterministic
begin
declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xx';
begin
declare continue handler for sqlexception
select 'Inner (good)' as 'h_xx';
insert into t3 values (1);
end;
end|
call h_ee()|
call h_es()|
call h_en()|
call h_ew()|
call h_ex()|
call h_se()|
call h_ss()|
call h_sn()|
call h_sw()|
call h_sx()|
call h_ne()|
call h_ns()|
call h_nn()|
call h_we()|
call h_ws()|
call h_ww()|
call h_xe()|
call h_xs()|
call h_xx()|
drop table t3|
drop procedure h_ee|
drop procedure h_es|
drop procedure h_en|
drop procedure h_ew|
drop procedure h_ex|
drop procedure h_se|
drop procedure h_ss|
drop procedure h_sn|
drop procedure h_sw|
drop procedure h_sx|
drop procedure h_ne|
drop procedure h_ns|
drop procedure h_nn|
drop procedure h_we|
drop procedure h_ws|
drop procedure h_ww|
drop procedure h_xe|
drop procedure h_xs|
drop procedure h_xx|
#
#
# Test cases for old bugs
# Test cases for old bugs
#
#
...
...
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