6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_3490_test.py

64 lines
1.2 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3849
ISSUE: 3849
TITLE: Concurrency problem when using named cursors
DESCRIPTION:
JIRA: CORE-3490
FBTEST: bugs.core_3490
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table my_table (a integer, b integer,c integer);
insert into my_table(a,b,c) values (1,1,1);
commit;
set transaction no wait;
set term ^ ;
execute block as
declare my_cursor cursor for
( select b from my_table
2022-01-22 21:59:15 +01:00
where a = 1
2021-04-26 20:07:00 +02:00
for update of b with lock
);
declare b integer;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
begin
open my_cursor;
fetch my_cursor into :b;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
update my_table set c = 2
where a = 1;
2022-01-22 21:59:15 +01:00
UPDATE MY_TABLE SET A = 0 WHERE A = 1;
2021-04-26 20:07:00 +02:00
update my_table set b = 2
where current of my_cursor;
end
^
set term ;^
set list on;
select * from my_table;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
A 0
B 2
C 2
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00