2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID : issue - 2727
ISSUE : 2727
TITLE : Include PLAN in mon $ statements
DESCRIPTION :
JIRA : CORE - 2303
2022-02-02 15:46:19 +01:00
FBTEST : bugs . core_2303
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
import pytest
from firebird . qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
db = db_factory ( )
2023-03-04 17:13:26 +01:00
act = python_act ( ' db ' )
2021-04-26 20:07:00 +02:00
2023-03-04 17:13:26 +01:00
TAG_TEXT = ' TAG_FOR_SEARCH '
expected_stdout = f """
select 1 / * { TAG_TEXT } * / from rdb $ database
2021-04-26 20:07:00 +02:00
Select Expression
2023-03-04 17:13:26 +01:00
- > Table " RDB$DATABASE " Full Scan
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version ( ' >=3.0 ' )
2023-03-04 17:13:26 +01:00
def test_1 ( act : Action , capsys ) :
with act . db . connect ( ) as con :
cur1 = con . cursor ( )
cur2 = con . cursor ( )
ps = cur1 . prepare ( f ' select 1 /* { TAG_TEXT } */ from rdb$database ' )
cur2 . execute ( f " select mon$sql_text, mon$explained_plan from mon$statements s where s.mon$sql_text containing ' { TAG_TEXT } ' and s.mon$sql_text NOT containing ' mon$statements ' " )
for r in cur2 :
print ( r [ 0 ] )
print ( r [ 1 ] )
2022-01-21 18:49:26 +01:00
act . expected_stdout = expected_stdout
2023-03-04 17:13:26 +01:00
act . stdout = capsys . readouterr ( ) . out
2022-01-21 18:49:26 +01:00
assert act . clean_stdout == act . clean_expected_stdout