2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3179
|
|
|
|
ISSUE: 3179
|
|
|
|
TITLE: isql extracts the array dimensions after the character set name
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-2788
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_2788
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
act = python_act('db', substitutions=[('- line .*', ''), ('At line .*', '')])
|
2021-11-16 19:44:53 +01:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
sql_ddl = """
|
|
|
|
create domain dm_test as char(1) character set iso8859_1[1:2];
|
|
|
|
create domain dm_test as char(1)[1:2] character set iso8859_1;
|
|
|
|
commit;
|
|
|
|
show domain dm_test;
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
expected_stdout = """
|
2021-11-16 19:44:53 +01:00
|
|
|
DM_TEST ARRAY OF [2]
|
|
|
|
CHAR(1) CHARACTER SET ISO8859_1 Nullable
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
expected_stderr_a = """
|
2021-11-16 19:44:53 +01:00
|
|
|
Statement failed, SQLSTATE = 42000
|
|
|
|
Dynamic SQL Error
|
|
|
|
-SQL error code = -104
|
|
|
|
-Token unknown - line 1, column 57
|
|
|
|
-[
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
expected_stderr_b = """
|
2021-11-16 19:44:53 +01:00
|
|
|
There is no domain DM_TEST in this database
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-11-16 19:44:53 +01:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-21 18:49:26 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stderr = expected_stderr_a
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.isql(switches=[], input=sql_ddl)
|
|
|
|
assert (act.clean_stderr == act.clean_expected_stderr and
|
|
|
|
act.clean_stdout == act.clean_expected_stdout)
|
2021-11-16 19:44:53 +01:00
|
|
|
#
|
2022-01-21 18:49:26 +01:00
|
|
|
act.reset()
|
|
|
|
act.isql(switches=['-x'])
|
|
|
|
xmeta = act.stdout
|
2021-11-16 19:44:53 +01:00
|
|
|
#
|
2022-01-21 18:49:26 +01:00
|
|
|
with act.db.connect() as con:
|
2021-11-16 19:44:53 +01:00
|
|
|
c = con.cursor()
|
|
|
|
c.execute('drop domain dm_test')
|
|
|
|
con.commit()
|
|
|
|
#
|
2022-01-21 18:49:26 +01:00
|
|
|
act.reset()
|
|
|
|
act.expected_stderr = expected_stderr_b
|
|
|
|
act.isql(switches=['-q'], input='show domain dm_test;')
|
|
|
|
assert act.clean_stderr == act.clean_expected_stderr
|
2021-11-16 19:44:53 +01:00
|
|
|
#
|
2022-01-21 18:49:26 +01:00
|
|
|
act.reset()
|
|
|
|
act.isql(switches=[], input=xmeta)
|
2021-11-16 19:44:53 +01:00
|
|
|
#
|
2022-01-21 18:49:26 +01:00
|
|
|
act.reset()
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.isql(switches=['-q'], input='show domain dm_test;')
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|