6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 10:50:42 +01:00
firebird-qa/tests/bugs/core_1156_test.py

79 lines
2.4 KiB
Python

#coding:utf-8
#
# id: bugs.core_1156
# title: Prepare fails when having a parameter in a DSQL statement before a sub query
# decription:
# tracker_id: CORE-1156
# min_versions: []
# versions: 2.1
# qmid: bugs.core_1156
import pytest
from firebird.qa import db_factory, python_act, Action
# version: 2.1
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
# c = db_conn.cursor()
# try:
# c.prep('select count(*) from rdb$database where ? < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 1')
#
# try:
# c.prep('select count(*) from rdb$database where (select count(*) from rdb$database) > ?')
# except:
# print ('Test FAILED in case 2')
#
# try:
# c.prep('select count(*) from rdb$database where ? < cast ((select count(*) from rdb$database) as integer)')
# except:
# print ('Test FAILED in case 3')
#
# try:
# c.prep('select count(*) from rdb$database where 0 < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 4')
#
# try:
# c.prep('select count(*) from rdb$database where cast (? as integer) < (select count(*) from rdb$database)')
# except:
# print ('Test FAILED in case 5')
#
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
@pytest.mark.version('>=2.1')
def test_1(act_1: Action):
with act_1.db.connect() as con:
c = con.cursor()
try:
c.prepare('select count(*) from rdb$database where ? < (select count(*) from rdb$database)')
except:
pytest.fail('Test FAILED in case 1')
try:
c.prepare('select count(*) from rdb$database where (select count(*) from rdb$database) > ?')
except:
pytest.fail('Test FAILED in case 2')
try:
c.prepare('select count(*) from rdb$database where ? < cast ((select count(*) from rdb$database) as integer)')
except:
pytest.fail('Test FAILED in case 3')
try:
c.prepare('select count(*) from rdb$database where 0 < (select count(*) from rdb$database)')
except:
pytest.fail('Test FAILED in case 4')
try:
c.prepare('select count(*) from rdb$database where cast (? as integer) < (select count(*) from rdb$database)')
except:
pytest.fail('Test FAILED in case 5')