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

65 lines
2.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3719
ISSUE: 3719
TITLE: Predicate 'blob_field LIKE ?' describes the parameter as VARCHAR(30) rather than as BLOB
2022-01-22 21:59:15 +01:00
DESCRIPTION:
JIRA: CORE-3353
FBTEST: bugs.core_3353
NOTES:
Code was splitted for 3.x and 4.x+ because:
1) output in 3.0 will contain values of sqltype with ZERO in bit_0, so it will be: 520 instead of previous 521.
(see also: core_4156.fbt)
2) we have to explicitly specify connection charset for FB 3.x otherwise 'UNICODE_FSS' will be issued in SQLDA
[10.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-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set sqlda_display on;
set planonly;
select rdb$procedure_source from rdb$procedures where rdb$procedure_source like ?;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act = isql_act('db', test_script, substitutions=[('^((?!(SQLSTATE|sqltype)).)*$', ''), ('[ \t]+', ' ')])
2022-01-22 21:59:15 +01:00
# version: 3.0
2021-04-26 20:07:00 +02:00
expected_stdout_1 = """
2021-08-03 23:29:08 +02:00
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0,<4.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout_1
# NB: we have to specify charset for FB 3.x otherwise 'UNICODE_FSS' will be issued in SQLDA:
act.execute(charset='utf8',combine_output = True)
2022-01-22 21:59:15 +01:00
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00
######################################################################################################
2021-04-26 20:07:00 +02:00
# version: 4.0
expected_stdout_2 = """
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
01: sqltype: 520 BLOB Nullable scale: 0 subtype: 1 len: 8 charset: 4 UTF8
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-22 21:59:15 +01:00
def test_2(act: Action):
act.expected_stdout = expected_stdout_2
act.execute(combine_output = True)
2022-01-22 21:59:15 +01:00
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00