2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4644
|
|
|
|
ISSUE: 4644
|
|
|
|
TITLE: Regression: ISQL does not destroy the SQL statement
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4321
|
2024-12-31 09:43:04 +01:00
|
|
|
NOTES:
|
|
|
|
[31.12.2024] pzotov
|
|
|
|
Added forgotten semicolon after 'SET LIST ON'.
|
|
|
|
Parsing problem appeared on 6.0.0.0.570 after d6ad19aa07deeaac8107a25a9243c5699a3c4ea1
|
|
|
|
("Refactor ISQL creating FrontendParser class").
|
|
|
|
It looks weird how it could work w/o 'token unknown / list' all this time in all major FB versions :-)
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
-- NB: 2.1.7 FAILED, output contains '4' for select count(*) ...
|
2024-12-31 09:43:04 +01:00
|
|
|
set list on;
|
|
|
|
select /* tag_for_watch */ 1 point_a from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_a from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_a from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_a from rdb$database;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2024-12-31 09:43:04 +01:00
|
|
|
select count(*) count_after_point_a from mon$statements s
|
|
|
|
where s.mon$sql_text containing '/* tag_for_watch */'
|
2021-04-26 20:07:00 +02:00
|
|
|
;
|
|
|
|
commit;
|
2024-12-31 09:43:04 +01:00
|
|
|
select count(*) count_after_commit_a from mon$statements s
|
|
|
|
where s.mon$sql_text containing '/* tag_for_watch */'
|
2021-04-26 20:07:00 +02:00
|
|
|
;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2024-12-31 09:43:04 +01:00
|
|
|
select /* tag_for_watch */ 1 point_b from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_b from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_b from rdb$database;
|
|
|
|
select /* tag_for_watch */ 1 point_b from rdb$database;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2024-12-31 09:43:04 +01:00
|
|
|
select count(*) count_after_point_b from mon$statements s
|
|
|
|
where s.mon$sql_text containing '/* tag_for_watch */'
|
2021-04-26 20:07:00 +02:00
|
|
|
;
|
|
|
|
commit;
|
2022-01-23 20:41:55 +01:00
|
|
|
|
2024-12-31 09:43:04 +01:00
|
|
|
select count(*) count_after_commit_b from mon$statements s
|
|
|
|
where s.mon$sql_text containing '/* tag_for_watch */'
|
2021-04-26 20:07:00 +02:00
|
|
|
;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2024-12-31 09:43:04 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')] )
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2024-12-31 09:43:04 +01:00
|
|
|
POINT_A 1
|
|
|
|
POINT_A 1
|
|
|
|
POINT_A 1
|
|
|
|
POINT_A 1
|
|
|
|
COUNT_AFTER_POINT_A 1
|
|
|
|
COUNT_AFTER_COMMIT_A 1
|
|
|
|
POINT_B 1
|
|
|
|
POINT_B 1
|
|
|
|
POINT_B 1
|
|
|
|
POINT_B 1
|
|
|
|
COUNT_AFTER_POINT_B 1
|
|
|
|
COUNT_AFTER_COMMIT_B 1
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2024-12-31 09:43:04 +01:00
|
|
|
act.execute(combine_output = True)
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|