2021-12-30 19:43:52 +01:00
|
|
|
#coding:utf-8
|
2022-01-27 20:08:36 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-6740
|
|
|
|
ISSUE: 6740
|
|
|
|
TITLE: Allow parenthesized query expression for standard-compliance
|
|
|
|
DESCRIPTION:
|
|
|
|
NOTES:
|
|
|
|
Queries which do not use `WITH` clause now can be enclosed in parenthesis,
|
|
|
|
but this leads to reduced number of max parts of UNIONed query, from 255 to 128.
|
|
|
|
JIRA: CORE-6511
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.gh_6740
|
2022-01-27 20:08:36 +01:00
|
|
|
"""
|
2021-12-30 19:43:52 +01:00
|
|
|
|
|
|
|
import pytest
|
2022-01-27 20:08:36 +01:00
|
|
|
from firebird.qa import *
|
2021-12-30 19:43:52 +01:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
db = db_factory()
|
2021-12-30 19:43:52 +01:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
act = python_act('db')
|
2021-12-30 19:43:52 +01:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
expected_stdout = """
|
|
|
|
8256
|
|
|
|
"""
|
2021-12-30 19:43:52 +01:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
@pytest.mark.skip('FIXME: Not IMPLEMENTED')
|
|
|
|
@pytest.mark.version('>=5.0')
|
|
|
|
def test_1(act: Action):
|
|
|
|
pytest.fail("Not IMPLEMENTED")
|
2021-12-30 19:43:52 +01:00
|
|
|
|
|
|
|
# test_script_1
|
|
|
|
#---
|
2022-01-25 22:55:48 +01:00
|
|
|
#
|
2021-12-30 19:43:52 +01:00
|
|
|
# # NB! Max limit of unioned-parts is 128 rather than 255!
|
|
|
|
# ########################
|
|
|
|
# NUM_OF_UNIONED_PARTS=128
|
|
|
|
# ########################
|
2022-01-25 22:55:48 +01:00
|
|
|
#
|
2021-12-30 19:43:52 +01:00
|
|
|
# unioned_query = '('
|
|
|
|
# for i in range(0,NUM_OF_UNIONED_PARTS):
|
|
|
|
# unioned_query = ''.join( (unioned_query, 'select %d ' % (i+1) + ('as i ' if i==0 else '') + 'from rdb$database') )
|
|
|
|
# if i < NUM_OF_UNIONED_PARTS-1:
|
|
|
|
# unioned_query = ''.join( (unioned_query, ' union all (') )
|
2022-01-25 22:55:48 +01:00
|
|
|
#
|
2021-12-30 19:43:52 +01:00
|
|
|
# unioned_query = ''.join( (unioned_query, ')' * NUM_OF_UNIONED_PARTS) )
|
|
|
|
# unioned_query += ';'
|
2022-01-25 22:55:48 +01:00
|
|
|
#
|
2021-12-30 19:43:52 +01:00
|
|
|
# #print(unioned_query)
|
2022-01-25 22:55:48 +01:00
|
|
|
#
|
2021-12-30 19:43:52 +01:00
|
|
|
# cur = db_conn.cursor()
|
|
|
|
# cur.execute(unioned_query)
|
|
|
|
# total = 0
|
|
|
|
# for r in cur:
|
|
|
|
# total += r[0]
|
|
|
|
# cur.close()
|
|
|
|
# print(total)
|
|
|
|
#---
|