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_3140_test.py

176 lines
5.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3517
ISSUE: 3517
TITLE: Preserve comments for parameters after altering procedures
DESCRIPTION:
JIRA: CORE-3140
FBTEST: bugs.core_3140
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
create or alter procedure sp_01 as begin end;
commit;
set term ^;
execute block as
begin
begin execute statement 'drop domain dm_i'; when any do begin end end
begin execute statement 'drop domain dm_s'; when any do begin end end
begin execute statement 'drop domain dm_t'; when any do begin end end
begin execute statement 'drop domain dm_b'; when any do begin end end
end^
set term ;^
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
create domain dm_i int;
create domain dm_s varchar(10);
create domain dm_t timestamp;
create domain dm_b blob;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
recreate table t_01(id int, s varchar(10), dts timestamp, b blob);
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
create or alter procedure sp_01(
a_01 int
,a_02 varchar(10)
,a_03 timestamp
,a_04 blob
) returns (
o_01 int
,o_02 varchar(10)
,o_03 timestamp
,o_04 blob
) as
begin
suspend;
end
^
set term ;^
commit;
comment on parameter sp_01.a_01 is 'INPUT par. ''a_01'', mech = 0';
comment on parameter sp_01.a_02 is 'INPUT par. ''a_02'', mech = 0';
comment on parameter sp_01.a_03 is 'INPUT par. ''a_03'', mech = 0';
comment on parameter sp_01.a_04 is 'INPUT par. ''a_04'', mech = 0';
comment on parameter sp_01.o_01 is 'OUTPUT par. ''o_01'', mech = 0';
comment on parameter sp_01.o_02 is 'OUTPUT par. ''o_02'', mech = 0';
comment on parameter sp_01.o_03 is 'OUTPUT par. ''o_03'', mech = 0';
comment on parameter sp_01.o_04 is 'OUTPUT par. ''o_04'', mech = 0';
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
alter procedure sp_01(
a_01 int
,a_02 varchar(10)
,a_03 timestamp
,a_04 blob
,a_05 type of dm_i
,a_06 type of dm_s
,a_07 type of dm_t
,a_08 type of dm_b
2022-01-22 21:59:15 +01:00
) returns (
2021-04-26 20:07:00 +02:00
o_01 int
,o_02 varchar(10)
,o_03 timestamp
,o_04 blob
,o_05 type of column t_01.id
,o_06 type of column t_01.id
,o_07 type of column t_01.id
,o_08 type of column t_01.id
) as
begin
suspend;
end
^
set term ;^
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
comment on parameter sp_01.a_05 is 'added INPUT par ''a_05'', mech = 1';
comment on parameter sp_01.a_06 is 'added INPUT par ''a_06'', mech = 1';
comment on parameter sp_01.a_07 is 'added INPUT par ''a_07'', mech = 1';
comment on parameter sp_01.a_08 is 'added INPUT par ''a_08'', mech = 1';
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
comment on parameter sp_01.o_05 is 'added OUTPUT par ''o_05'', mech = 1';
comment on parameter sp_01.o_06 is 'added OUTPUT par ''o_06'', mech = 1';
comment on parameter sp_01.o_07 is 'added OUTPUT par ''o_07'', mech = 1';
comment on parameter sp_01.o_08 is 'added OUTPUT par ''o_08'', mech = 1';
commit;
2022-01-22 21:59:15 +01:00
set width par_name 31;
set width par_desc 50;
2021-04-26 20:07:00 +02:00
set list on;
2022-01-22 21:59:15 +01:00
select
cast(rdb$parameter_name as varchar(31)) par_name,
cast(rdb$description as varchar(50)) par_desc,
coalesce(rdb$parameter_mechanism, 0 ) par_mech
from rdb$procedure_parameters
2021-04-26 20:07:00 +02:00
where rdb$procedure_name='SP_01'
order by par_name;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
PAR_NAME A_01
2021-04-26 20:07:00 +02:00
PAR_DESC INPUT par. 'a_01', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME A_02
2021-04-26 20:07:00 +02:00
PAR_DESC INPUT par. 'a_02', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME A_03
2021-04-26 20:07:00 +02:00
PAR_DESC INPUT par. 'a_03', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME A_04
2021-04-26 20:07:00 +02:00
PAR_DESC INPUT par. 'a_04', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME A_05
2021-04-26 20:07:00 +02:00
PAR_DESC added INPUT par 'a_05', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME A_06
2021-04-26 20:07:00 +02:00
PAR_DESC added INPUT par 'a_06', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME A_07
2021-04-26 20:07:00 +02:00
PAR_DESC added INPUT par 'a_07', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME A_08
2021-04-26 20:07:00 +02:00
PAR_DESC added INPUT par 'a_08', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME O_01
2021-04-26 20:07:00 +02:00
PAR_DESC OUTPUT par. 'o_01', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME O_02
2021-04-26 20:07:00 +02:00
PAR_DESC OUTPUT par. 'o_02', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME O_03
2021-04-26 20:07:00 +02:00
PAR_DESC OUTPUT par. 'o_03', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME O_04
2021-04-26 20:07:00 +02:00
PAR_DESC OUTPUT par. 'o_04', mech = 0
PAR_MECH 0
2022-01-22 21:59:15 +01:00
PAR_NAME O_05
2021-04-26 20:07:00 +02:00
PAR_DESC added OUTPUT par 'o_05', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME O_06
2021-04-26 20:07:00 +02:00
PAR_DESC added OUTPUT par 'o_06', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME O_07
2021-04-26 20:07:00 +02:00
PAR_DESC added OUTPUT par 'o_07', mech = 1
PAR_MECH 1
2022-01-22 21:59:15 +01:00
PAR_NAME O_08
2021-04-26 20:07:00 +02:00
PAR_DESC added OUTPUT par 'o_08', mech = 1
PAR_MECH 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5.1')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00