2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-24 20:27:02 +01:00
|
|
|
"""
|
|
|
|
ID: issue-5123
|
|
|
|
ISSUE: 5123
|
|
|
|
TITLE: Make ISQL display character set when sqlda_display is on
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4826
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4826
|
2023-12-12 19:12:08 +01:00
|
|
|
NOTES:
|
|
|
|
[12.12.2023] pzotov
|
|
|
|
Added 'SQLSTATE' in substitutions: runtime error must not be filtered out by '?!(...)' pattern
|
|
|
|
("negative lookahead assertion", see https://docs.python.org/3/library/re.html#regular-expression-syntax).
|
|
|
|
Added 'combine_output = True' in order to see SQLSTATE if any error occurs.
|
2022-01-24 20:27:02 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-24 20:27:02 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-24 20:27:02 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-24 20:27:02 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
-- Before WI-T3.0.0.31876 charsets were displeyd for field of ANY type, not only for text.
|
|
|
|
recreate table test1(
|
|
|
|
id1 smallint,
|
|
|
|
id2 int,
|
|
|
|
id3 bigint,
|
|
|
|
nf1 numeric(12,4),
|
|
|
|
nf2 double precision,
|
|
|
|
nf3 float,
|
|
|
|
tf1 date,
|
|
|
|
tf2 time,
|
|
|
|
tf3 timestamp,
|
|
|
|
boo boolean,
|
2021-10-21 19:29:23 +02:00
|
|
|
tx1 char character set utf8,
|
2021-04-26 20:07:00 +02:00
|
|
|
tx2 varchar(10) character set iso8859_1,
|
|
|
|
tx3 nchar,
|
|
|
|
-- doesn`t compile: tx4 nvarchar(10),
|
|
|
|
tx4 national character varying(32760),
|
|
|
|
tb1 blob sub_type 1 character set win1251,
|
|
|
|
tb2 blob sub_type 0
|
|
|
|
);
|
|
|
|
commit;
|
2021-10-21 19:29:23 +02:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
set sqlda_display on;
|
|
|
|
select * from test1;
|
|
|
|
commit;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-12-12 19:12:08 +01:00
|
|
|
act = isql_act('db', test_script, substitutions = [ ('^((?!SQLSTATE|sqltype).)*$', ''), ('[ \t]+', ' ') ] )
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-24 20:27:02 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
01: sqltype: 500 SHORT Nullable scale: 0 subtype: 0 len: 2
|
|
|
|
02: sqltype: 496 LONG Nullable scale: 0 subtype: 0 len: 4
|
|
|
|
03: sqltype: 580 INT64 Nullable scale: 0 subtype: 0 len: 8
|
|
|
|
04: sqltype: 580 INT64 Nullable scale: -4 subtype: 1 len: 8
|
|
|
|
05: sqltype: 480 DOUBLE Nullable scale: 0 subtype: 0 len: 8
|
|
|
|
06: sqltype: 482 FLOAT Nullable scale: 0 subtype: 0 len: 4
|
|
|
|
07: sqltype: 570 SQL DATE Nullable scale: 0 subtype: 0 len: 4
|
|
|
|
08: sqltype: 560 TIME Nullable scale: 0 subtype: 0 len: 4
|
|
|
|
09: sqltype: 510 TIMESTAMP Nullable scale: 0 subtype: 0 len: 8
|
|
|
|
10: sqltype: 32764 BOOLEAN Nullable scale: 0 subtype: 0 len: 1
|
|
|
|
11: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 4 charset: 4 UTF8
|
|
|
|
12: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 10 charset: 21 ISO8859_1
|
|
|
|
13: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 1 charset: 21 ISO8859_1
|
|
|
|
14: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 32760 charset: 21 ISO8859_1
|
|
|
|
15: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 52 WIN1251
|
|
|
|
16: sqltype: 520 BLOB Nullable scale: 0 subtype: 0 len: 8
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-24 20:27:02 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2023-12-12 19:12:08 +01:00
|
|
|
act.execute(combine_output = True)
|
2022-01-24 20:27:02 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|