2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-23 20:41:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-4395
|
|
|
|
ISSUE: 4395
|
|
|
|
TITLE: Problem with "CREATE DATABASE ... COLLATION ..." and 1 dialect
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4067
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4067
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-11-18 20:15:37 +01:00
|
|
|
from pathlib import Path
|
2022-01-23 20:41:55 +01:00
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory()
|
2024-05-09 23:31:51 +02:00
|
|
|
act = python_act('db', substitutions = [('[ \t]+', ' ')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2024-05-09 23:31:51 +02:00
|
|
|
SQL_DIALECT 1
|
2021-11-18 20:15:37 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
temp_db = temp_file('tmp_4067_1.fdb')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action, temp_db: Path):
|
2021-11-18 20:15:37 +01:00
|
|
|
test_script = f"""
|
2024-05-09 23:31:51 +02:00
|
|
|
set bail on;
|
|
|
|
set list on;
|
|
|
|
set sql dialect 1;
|
|
|
|
create database 'localhost:{str(temp_db)}' page_size 4096 default character set win1251 collation win1251;
|
|
|
|
select mon$sql_dialect as sql_dialect from mon$database;
|
|
|
|
commit;
|
|
|
|
drop database;
|
|
|
|
"""
|
2022-01-23 20:41:55 +01:00
|
|
|
act.expected_stdout = expected_stdout
|
2024-05-09 23:31:51 +02:00
|
|
|
act.isql(switches = ['-q'], input=test_script, connect_db=False, combine_output = True)
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|