2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-19 17:54:56 +01:00
|
|
|
"""
|
|
|
|
ID: issue-1590
|
2023-10-05 10:07:53 +02:00
|
|
|
ISSUE: https://github.com/FirebirdSQL/firebird/issues/1590
|
2022-01-19 17:54:56 +01:00
|
|
|
TITLE: CHARACTER SET GBK is not installed
|
|
|
|
DESCRIPTION:
|
2023-10-05 10:07:53 +02:00
|
|
|
Default character set is GBK
|
|
|
|
Create Table T1(ID integer, FName Varchar(20); -- OK
|
|
|
|
Commit; ---Error Message: CHARACTER SET GBK is not installed
|
2022-01-19 17:54:56 +01:00
|
|
|
JIRA: CORE-1167
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_1167
|
2023-10-05 10:07:53 +02:00
|
|
|
NOTES:
|
|
|
|
[05.10.2023] pzotov
|
|
|
|
Removed SHOW TABLE command for check result because its output often changes.
|
|
|
|
Query to RDB$ tables is used instead.
|
2022-01-19 17:54:56 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-19 17:54:56 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2023-10-05 10:07:53 +02:00
|
|
|
import time
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-10-05 10:07:53 +02:00
|
|
|
db = db_factory(charset = 'GBK')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-10-05 10:07:53 +02:00
|
|
|
test_script = """
|
|
|
|
recreate table t1(
|
|
|
|
f1 varchar(20) character set gbk
|
|
|
|
,f2 varchar(20) character set gbk collate gbk_unicode
|
|
|
|
);
|
|
|
|
commit;
|
|
|
|
set count on;
|
|
|
|
set list on;
|
|
|
|
select
|
|
|
|
rf.rdb$field_name as field_name
|
|
|
|
,f.rdb$character_set_id as field_cset_id
|
|
|
|
,f.rdb$collation_id as field_coll_id
|
|
|
|
,f.rdb$character_length as field_cset_len
|
|
|
|
,c.rdb$character_set_name as cset_name
|
|
|
|
,k.rdb$collation_name as field_collation
|
|
|
|
from rdb$relation_fields rf
|
|
|
|
join rdb$fields f on rf.rdb$field_source = f.rdb$field_name
|
|
|
|
join rdb$character_sets c on f.rdb$character_set_id = c.rdb$character_set_id
|
|
|
|
left join rdb$collations k on c.rdb$character_set_id = k.rdb$character_set_id and f.rdb$collation_id = k.rdb$collation_id
|
|
|
|
where rf.rdb$relation_name = upper('T1')
|
|
|
|
order by
|
|
|
|
field_name
|
|
|
|
,field_cset_id
|
|
|
|
,field_coll_id
|
|
|
|
;
|
2021-04-26 20:07:00 +02:00
|
|
|
"""
|
|
|
|
|
2022-01-19 17:54:56 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-10-05 10:07:53 +02:00
|
|
|
expected_stdout = """
|
|
|
|
FIELD_NAME F1
|
|
|
|
FIELD_CSET_ID 67
|
|
|
|
FIELD_COLL_ID 0
|
|
|
|
FIELD_CSET_LEN 20
|
|
|
|
CSET_NAME GBK
|
|
|
|
FIELD_COLLATION GBK
|
|
|
|
|
|
|
|
FIELD_NAME F2
|
|
|
|
FIELD_CSET_ID 67
|
|
|
|
FIELD_COLL_ID 1
|
|
|
|
FIELD_CSET_LEN 20
|
|
|
|
CSET_NAME GBK
|
|
|
|
FIELD_COLLATION GBK_UNICODE
|
|
|
|
|
|
|
|
Records affected: 2
|
2021-04-26 20:07:00 +02:00
|
|
|
"""
|
|
|
|
|
2022-01-19 17:54:56 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2023-10-05 10:07:53 +02:00
|
|
|
act.execute(combine_output = True)
|
2022-01-19 17:54:56 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|