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

74 lines
2.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_2475
# title: External table data not visible to other sessions in Classic
# decription: In 2.1.2 SuperServer, any data written to external tables are visible to other sessions.
# However in Classic, this data is not visible. It seems to be cached and written to file eventually, when this happens it becomes visible.
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
# THIS TEST WILL END WITH ERROR IF EXTERNAL TABLE ACCESS IS NOT ALLOWED, WHICH IS BY DEFAULT. It's necessary to adjust firebird.conf.
# tracker_id: CORE-2475
# min_versions: ['2.1.3']
# versions: 2.1.3
# qmid: None
import pytest
2021-11-16 19:44:53 +01:00
from pathlib import Path
from firebird.qa import db_factory, python_act, Action, temp_file
2021-04-26 20:07:00 +02:00
# version: 2.1.3
# resources: None
substitutions_1 = []
2021-11-16 19:44:53 +01:00
init_script_1 = """"""
2021-04-26 20:07:00 +02:00
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
# test_script_1
#---
# # init
# import os
# ext_filename = '%sEXT1.TBL' % context[db_path_property]
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
# # session A
# c1 = db_conn.cursor()
# c1.execute("insert into EXT1 (PK) values (1)")
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
# db_conn.commit()
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
# # session B
# con2 = kdb.connect(dsn=dsn,user=user_name,password=user_password)
# c2 = con2.cursor()
# c2.execute('select * from EXT1')
# printData(c2)
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
# # cleanup
# con2.close()
# try:
# os.remove(ext_filename)
# except:
# print("Error while removing external table file")
2021-11-16 19:44:53 +01:00
#
2021-04-26 20:07:00 +02:00
#---
2021-11-16 19:44:53 +01:00
act_1 = python_act('db_1', substitutions=substitutions_1)
2021-04-26 20:07:00 +02:00
2021-11-16 19:44:53 +01:00
external_table = temp_file('EXT1.TBL')
2021-04-26 20:07:00 +02:00
2021-11-16 19:44:53 +01:00
@pytest.mark.version('>=2.1.3')
def test_1(act_1: Action, external_table: Path):
# Create external table
act_1.isql(switches=[],
input=f"create table EXT1 external file '{str(external_table)}' (PK INTEGER); exit;")
# session A
with act_1.db.connect() as con:
c = con.cursor()
c.execute("insert into EXT1 (PK) values (1)")
con.commit()
# session B
with act_1.db.connect() as con:
c = con.cursor()
c.execute('select * from EXT1')
result = c.fetchall()
assert result == [(1, )]