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

73 lines
1.9 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-5351
ISSUE: 5351
TITLE: Add datatypes (VAR)BINARY(n) and BINARY VARYING(n) as alias for (VAR)CHAR(n) CHARACTER SET OCTETS
DESCRIPTION:
JIRA: CORE-5064
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
import pytest
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
test_script = """
2021-04-26 20:07:00 +02:00
recreate table test(x binary(8), y varbinary(8));
set list on;
set sqlda_display on;
2022-01-25 22:55:48 +01:00
2021-04-26 20:07:00 +02:00
-- Check that new datatypes can be used in SQL:
select rdb$db_key,t.* from test t;
-- Check that new datatypes can be used in PSQL:
2022-01-25 22:55:48 +01:00
set term ^;
execute block returns(x binary(8), y varbinary(8)) as
begin
select rdb$db_key,rdb$db_key
from rdb$database where 1=0
into x,y;
suspend;
end^
2021-04-26 20:07:00 +02:00
set term ;^
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
INPUT message field count: 0
OUTPUT message field count: 3
01: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 8 charset: 1 OCTETS
: name: DB_KEY alias: DB_KEY
: table: TEST owner: SYSDBA
02: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 8 charset: 1 OCTETS
: name: X alias: X
: table: TEST owner: SYSDBA
03: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 8 charset: 1 OCTETS
: name: Y alias: Y
: table: TEST owner: SYSDBA
INPUT message field count: 0
OUTPUT message field count: 2
01: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 8 charset: 1 OCTETS
: name: X alias: X
: table: owner:
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 8 charset: 1 OCTETS
: name: Y alias: Y
: table: owner:
X <null>
Y <null>
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-25 22:55:48 +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