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

72 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-4330
ISSUE: 4330
TITLE: Parametrized execute statement fails
DESCRIPTION:
JIRA: CORE-3998
FBTEST: bugs.core_3998
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
init_script = """
2021-04-26 20:07:00 +02:00
create table t (
id integer not null,
dir varchar(100) default '' not null,
note varchar(100) default '' not null
);
commit;
insert into t (id, dir, note) values (1, 'a', 'b');
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
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
set term ^;
execute block
as
declare variable dir varchar(100);
declare variable note varchar(100);
declare variable id integer;
begin
id = 1;
dir = 'a';
note = 'bbbb';
execute statement ('
update t set
note = :note
where
id = :id and dir = :dir
')
(
id := :id,
note := :note,
dir := :dir
);
end ^
set term ;^
commit;
set list on;
select * from t;
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, substitutions=[('[ \t]+', ' ')])
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
ID 1
DIR a
2022-01-22 21:59:15 +01:00
NOTE bbbb
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