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

102 lines
2.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_4200
# title: An uncommitted select of the pseudo table sec$users blocks new database connections
2021-11-18 20:15:37 +01:00
# decription:
2021-04-26 20:07:00 +02:00
# Checked on: 4.0.0.1635: OK, 1.866s; 3.0.5.33180: OK, 1.869s.
2021-11-18 20:15:37 +01:00
#
# [pcisar] 18.11.2021
# New test implementation according to bug description:
# session 1:
# connect to test database
# start transaction
# select * from sec$users
# (do *not* commit)
# session 2:
# connect to test database => results in sql error -902;
# engine code 335544472 Your user name and password are not defined.
# Ask your database administrator to set up a Firebird login.
#
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-4200
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
2021-11-18 20:15:37 +01:00
from firebird.qa import db_factory, python_act, Action
2021-04-26 20:07:00 +02:00
# version: 3.0
# resources: None
2021-11-18 20:15:37 +01:00
substitutions_1 = []
2021-04-26 20:07:00 +02:00
2021-11-18 20:15:37 +01:00
init_script_1 = """"""
2021-04-26 20:07:00 +02:00
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# db_conn.close()
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# custom_tpb = fdb.TPB()
# custom_tpb.access_mode = fdb.isc_tpb_read
# custom_tpb.isolation_level = (fdb.isc_tpb_read_committed, fdb.isc_tpb_rec_version)
# custom_tpb.lock_resolution = fdb.isc_tpb_nowait
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# con1=fdb.connect(dsn = dsn, user = 'SYSDBA', password = 'masterkey')
# trn1=con1.trans( default_tpb = custom_tpb )
# cur1=trn1.cursor()
# cur1.execute('select sec$user_name from sec$users')
# for r in cur1:
# pass
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# #custom_con = fdb.Connection()
# #custom_con._default_tpb = custom_tpb
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# con2=fdb.connect( dsn = dsn, user = 'tmp$c4200_leg', password = '123') #, connection_class = custom_con)
# con3=fdb.connect( dsn = dsn, user = 'tmp$c4200_srp', password = '123') #, connection_class = custom_con)
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# check_sql='select mon$user as who_am_i, mon$auth_method as auth_method from mon$attachments'
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# trn2=con2.trans( default_tpb = custom_tpb )
# cur2=trn2.cursor()
# cur2.execute(check_sql)
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# trn3=con3.trans( default_tpb = custom_tpb )
# cur3=trn3.cursor()
# cur3.execute(check_sql)
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# for c in (cur2, cur3):
# cur_cols=c.description
# for r in c:
# for i in range(0,len(cur_cols)):
# print( cur_cols[i][0],':', r[i] )
# c.close()
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# trn2.rollback()
# trn3.rollback()
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# con2.close()
# con3.close()
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
# cur1.close()
# con1.execute_immediate('drop user tmp$c4200_leg using plugin Legacy_UserManager')
# con1.execute_immediate('drop user tmp$c4200_srp using plugin Srp')
# con1.commit()
2021-11-18 20:15:37 +01:00
#
#
2021-04-26 20:07:00 +02:00
#---
2021-11-18 20:15:37 +01:00
act_1 = python_act('db_1', substitutions=substitutions_1)
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2021-11-18 20:15:37 +01:00
def test_1(act_1: Action):
with act_1.db.connect() as con_1:
c_1 = con_1.cursor()
c_1.execute('select * from sec$users')
with act_1.db.connect() as con_2:
pass # Connect should not raise an exception
2021-04-26 20:07:00 +02:00