6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_2907_test.py

81 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-3291
ISSUE: 3291
TITLE: Exception handling with EXECUTE STATEMENT
DESCRIPTION:
Unable to catch exceptions that are thrown inside a dynamic builded execute block.
JIRA: CORE-2907
FBTEST: bugs.core_2907
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
init_script = """CREATE OR ALTER EXCEPTION EX_TEST 'test';
2021-04-26 20:07:00 +02:00
SET TERM ^ ;
CREATE OR ALTER procedure sp_1
as
declare variable v_stmt varchar(256);
begin
v_stmt = 'execute block as '||
'begin '||
' exception ex_test; '||
'end';
execute statement v_stmt;
end
^
SET TERM ; ^
SET TERM ^ ;
CREATE OR ALTER procedure sp_2
as
begin
begin
execute procedure sp_1;
when exception ex_test do
begin
exit;
end
end
end
^
SET TERM ; ^
SET TERM ^ ;
CREATE OR ALTER procedure sp_3
as
begin
begin
execute procedure sp_1;
when any do
begin
exit;
end
end
end
^
SET TERM ; ^
commit;
"""
2022-01-21 18:49:26 +01:00
db = db_factory(charset='UTF8', init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """EXECUTE PROCEDURE SP_2;
2021-04-26 20:07:00 +02:00
EXECUTE PROCEDURE SP_3;
"""
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
@pytest.mark.version('>=3.0')
def test_1(act: Action):
2022-01-25 22:55:48 +01:00
act.execute()