2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID : issue - 5136
ISSUE : 5136
TITLE : Transactions with isc_tpb_autocommit can hang the server
DESCRIPTION :
JIRA : CORE - 4840
2022-02-02 15:46:19 +01:00
FBTEST : bugs . core_4840
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-24 20:27:02 +01:00
from firebird . qa import *
2021-11-26 19:20:43 +01:00
from firebird . driver import TPB , Isolation
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory ( charset = ' UTF8 ' )
act = python_act ( ' db ' )
sp_ddl = """
create or alter procedure sp_test ( in1 integer , in2 float )
returns (
out1 varchar ( 20 ) ,
out2 double precision ,
out3 integer
) as
declare x integer ;
begin
out1 = ' out string ' ;
out2 = 2 * in2 ;
out3 = 3 * in1 ;
suspend ;
end
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
OUT1 out string
OUT2 6.283185005187988
OUT3 37035
2021-11-26 19:20:43 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
@pytest.mark.version ( ' >=3 ' )
def test_1 ( act : Action ) :
with act . db . connect ( ) as con :
2021-11-26 19:20:43 +01:00
custom_tpb = TPB ( isolation = Isolation . READ_COMMITTED_RECORD_VERSION , auto_commit = True ) . get_buffer ( )
con . begin ( custom_tpb )
c = con . cursor ( )
sp_rem = " comment on procedure sp_test is ' Det är inte alla präster, som göra prästgården eller dess torp till änkesäte åt orkeslösa trotjänarinnor, hade biskopen en gång sagt om Helenas prost. ' "
# For confirmation of ticket issues it is enough to do just this:
c . execute ( sp_ddl )
c . execute ( sp_rem )
con . commit ( )
#
2022-01-24 20:27:02 +01:00
act . expected_stdout = expected_stdout
act . isql ( switches = [ ' -q ' ] , input = ' set list on; select * from sp_test(12345, 3.1415926); ' )
assert act . clean_stdout == act . clean_expected_stdout