6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_4566_test.py

72 lines
1.7 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4883
ISSUE: 4883
TITLE: Incorrect size of the output parameter/argument when execute block, procedure
or function use system field in metadata charset
2022-01-23 20:41:55 +01:00
DESCRIPTION:
JIRA: CORE-4566
FBTEST: bugs.core_4566
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory(charset='WIN1251')
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set term ^;
create or alter function get_mnemonic (
afield_name type of column rdb$types.rdb$field_name,
atype type of column rdb$types.rdb$type)
returns type of column rdb$types.rdb$type_name
as
begin
return (select rdb$type_name
from rdb$types
2022-01-23 20:41:55 +01:00
where
2021-04-26 20:07:00 +02:00
rdb$field_name = :afield_name
and rdb$type = :atype
order by rdb$type_name
);
2022-01-23 20:41:55 +01:00
end
2021-04-26 20:07:00 +02:00
^
set term ;^
commit;
2022-01-23 20:41:55 +01:00
2021-04-26 20:07:00 +02:00
set list on;
select get_mnemonic('MON$SHUTDOWN_MODE', 1) as mnemonic from rdb$database;
--select cast(get_mnemonic('MON$SHUTDOWN_MODE', 1) as varchar(100)) as mnemonic from rdb$database;
2022-01-23 20:41:55 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
execute block returns (FIELD_NAME RDB$FIELD_NAME) as
begin
for select rdb$type_name
from rdb$types
where rdb$type_name starting with 'BLOB_FILTER'
order by rdb$type_name
rows 1
into field_name
do
suspend;
end
^
set term ;^
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
MNEMONIC MULTI_USER_SHUTDOWN
FIELD_NAME BLOB_FILTER
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +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