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

67 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-2463
ISSUE: 2463
TITLE: Problem with a read-only marked database
DESCRIPTION:
Since FB 2.1 engine performs transliteraion of blobs between character sets.
In this case system blob, stored in UNICODE_FSS, transliterated into connection charset.
To do this, temporary blob is created. Engine didn't support temporary blobs creation in
read-only databases since read-only databases was introduced
JIRA: CORE-2026
FBTEST: bugs.core_2026
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-21 18:49:26 +01:00
from firebird.qa import *
2021-11-12 18:29:54 +01:00
from firebird.driver import DbAccessMode
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table test(x integer default 0);
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
db = db_factory(charset='ISO8859_1', init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """
2021-11-12 18:29:54 +01:00
set list on;
set blob all;
select mon$read_only from mon$database;
set count on;
select RDB$FIELD_NAME, rdb$default_source from rdb$relation_fields
where rdb$default_source is not null;
"""
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script, substitutions=[('RDB\\$DEFAULT_SOURCE.*', '')])
2021-11-12 18:29:54 +01:00
2022-01-21 18:49:26 +01:00
expected_stdout_a = """
2021-11-12 18:29:54 +01:00
MON$READ_ONLY 0
RDB$FIELD_NAME X
default 0
Records affected: 1
"""
2022-01-21 18:49:26 +01:00
expected_stdout_b = """
2021-11-12 18:29:54 +01:00
MON$READ_ONLY 1
RDB$FIELD_NAME X
default 0
Records affected: 1
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout_a
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-11-12 18:29:54 +01:00
#
2022-01-21 18:49:26 +01:00
with act.connect_server() as srv:
srv.database.set_access_mode(database=act.db.db_path, mode=DbAccessMode.READ_ONLY)
2021-11-12 18:29:54 +01:00
#
2022-01-21 18:49:26 +01:00
act.reset()
act.expected_stdout = expected_stdout_b
act.isql(switches=[], charset='iso8859_1', input=act.script)
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00