2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4483
|
|
|
|
ISSUE: 4483
|
2023-12-12 18:15:28 +01:00
|
|
|
TITLE: RDB$GET_CONTEXT/RDB$SET_CONTEXT parameters incorrectly described as CHAR NOT NULL instead of VARCHAR NULLABLE
|
2022-01-23 20:41:55 +01:00
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4156
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4156
|
2023-12-12 18:15:28 +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-23 20:41:55 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set planonly;
|
|
|
|
set sqlda_display on;
|
|
|
|
select rdb$set_context( ?, ?, ?) x from rdb$database;
|
|
|
|
-- NB: output in 3.0 will contain values of sqltype with ZERO in bit_0,
|
|
|
|
-- so it will be: 448 instead of previous 449, and 496 instead of 497.
|
|
|
|
-- Result is value that equal to constant from src/dsql/sqlda_pub.h, i.e:
|
|
|
|
-- #define SQL_VARYING 448
|
|
|
|
-- #define SQL_LONG 496
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-12-12 18:15:28 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=[('^((?!(SQLSTATE|sqltype)).)*$', ''), ('[\t ]+', ' ')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
01: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 80 charset: 0 NONE
|
|
|
|
02: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 80 charset: 0 NONE
|
|
|
|
03: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 255 charset: 0 NONE
|
|
|
|
01: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2023-12-12 18:15:28 +01:00
|
|
|
act.execute(combine_output = True)
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|