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

75 lines
2.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5510
ISSUE: 5510
TITLE: EXECUTE STATEMENT: BLR error if more than 256 output parameters exist
DESCRIPTION:
We define here number of output args for which one need to made test - see var 'sp_args_count'.
Then we open .sql file and GENERATE it content based on value of 'sp_args_count' (procedure will
have header and body with appropriate number of arguments and statement to be executed).
Finally, we run ISQL subprocess with giving to it for execution just generated .sql script.
ISQL should _not_ issue any error and all lines of its STDOUT should start from the names of
output arguments (letter 'O': O1, O2, ... O5000).
JIRA: CORE-5231
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-30 19:13:50 +01:00
from pathlib import Path
2022-01-25 22:55:48 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = python_act('db', substitutions=[('^O.*', '')])
2021-04-26 20:07:00 +02:00
2021-11-30 19:13:50 +01:00
SP_ARGS_COUNT = 5000
ddl_script = temp_file('core_5231.sql')
2021-04-26 20:07:00 +02:00
2021-11-30 19:13:50 +01:00
def build_script(ddl_script: Path):
with open(ddl_script, 'w') as ddl_file:
ddl_file.write("""
set term ^;
execute block as
begin
execute statement 'drop procedure sp_test';
when any do begin end
end ^
commit ^
create or alter procedure sp_test returns (
""")
delimiter = ''
for i in range(SP_ARGS_COUNT):
ddl_file.write(f'{delimiter}o{i} int')
delimiter = ','
ddl_file.write(
""") as begin
for execute statement 'select
""")
2021-04-26 20:07:00 +02:00
2021-11-30 19:13:50 +01:00
delimiter = ''
for i in range(SP_ARGS_COUNT):
ddl_file.write(f'{delimiter}{i}')
delimiter = ','
ddl_file.write(" from rdb$database'\ninto ")
delimiter = ''
for i in range(SP_ARGS_COUNT):
ddl_file.write(f'{delimiter}o{i}')
delimiter = ','
ddl_file.write("""
do suspend;
end^
set term ;^
commit;
set list on;
select * from sp_test;
""")
@pytest.mark.version('>=3.0')
2022-01-25 22:55:48 +01:00
def test_1(act: Action, ddl_script: Path):
2021-11-30 19:13:50 +01:00
build_script(ddl_script)
2022-01-25 22:55:48 +01:00
act.isql(switches=[], input_file=ddl_script, charset='NONE')
assert act.clean_stdout == act.clean_expected_stdout