6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_1213_test.py

65 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-19 17:54:56 +01:00
"""
ID: issue-1637
ISSUE: 1637
TITLE: CURRENT OF support views
DESCRIPTION:
JIRA: CORE-1213
FBTEST: bugs.core_1213
2022-01-19 17:54:56 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
init_script = """CREATE TABLE TAB1 (COL1 INTEGER);
2021-04-26 20:07:00 +02:00
CREATE VIEW V1 (COL1) AS SELECT COL1 FROM TAB1;
COMMIT;
INSERT INTO TAB1 (COL1) VALUES (1);
INSERT INTO TAB1 (COL1) VALUES (2);
INSERT INTO TAB1 (COL1) VALUES (3);
COMMIT;
SET TERM ^ ;
CREATE PROCEDURE P1 AS
DECLARE vCOL1 INTEGER;
BEGIN
FOR SELECT COL1 FROM V1 WHERE COL1 IN (2,3) INTO :vCOL1 AS CURSOR VIEW_CURSOR DO
BEGIN
DELETE FROM V1 WHERE CURRENT OF VIEW_CURSOR;
END
END ^
COMMIT ^
"""
2022-01-19 17:54:56 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
test_script = """SELECT COL1 FROM V1;
2021-04-26 20:07:00 +02:00
EXECUTE PROCEDURE P1;
SELECT COL1 FROM V1;
"""
2022-01-19 17:54:56 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-19 17:54:56 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
COL1
============
1
2
3
COL1
============
1
"""
2022-01-19 17:54:56 +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