mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 21:43:06 +01:00
190 lines
7.3 KiB
Python
190 lines
7.3 KiB
Python
#coding:utf-8
|
||
#
|
||
# id: bugs.core_5538
|
||
# title: DELETE FROM MON$STATEMENTS does not interrupt a longish fetch
|
||
# decription:
|
||
# We create several tables and add single row to each of them. Row contains name of corresponding table.
|
||
# Then we create view that based on UNIONED-query to all of these tables.
|
||
# After this, we handle list of PATTERNS and pass each of its elements (herteafter its name is: <P>) to
|
||
# '-include_data' gbak command switch.
|
||
# Further we RESTORE from this .fbk to temporary DB. This new database which contain only those tables
|
||
# which names matched to '-include_data <P>' pattern on previous step.
|
||
# We also must check joint usage of '-include_data' and (old) '-skip_data' command switches.
|
||
# For this purpose we create single pattern for EXCLUDING some tables (see 'skip_ptn' variable) and use
|
||
# this pattern together with elements from patterns list for tables which data must be included in .fbk.
|
||
#
|
||
# Checked on: 4.0.0.1639 SS: 13.978s.
|
||
#
|
||
#
|
||
# tracker_id: CORE-5538
|
||
# min_versions: ['4.0']
|
||
# versions: 4.0
|
||
# qmid: None
|
||
|
||
import pytest
|
||
from firebird.qa import db_factory, isql_act, Action
|
||
|
||
# version: 4.0
|
||
# resources: None
|
||
|
||
substitutions_1 = [('[ \t]+', ' ')]
|
||
|
||
init_script_1 = """
|
||
recreate view v_test as select 1 x from rdb$database;
|
||
commit;
|
||
recreate table test_anna( s varchar(20) default 'anna' );
|
||
recreate table test_beta( s varchar(20) default 'beta' );
|
||
recreate table test_ciao( s varchar(20) default 'ciao' );
|
||
recreate table test_cola( s varchar(20) default 'cola' );
|
||
recreate table test_dina( s varchar(20) default 'dina' );
|
||
recreate table test_doca( s varchar(20) default 'doca' );
|
||
recreate table test_docb( s varchar(20) default 'docb' );
|
||
recreate table test_docc( s varchar(20) default 'docc' );
|
||
recreate table test_dora( s varchar(20) default 'dora' );
|
||
recreate table test_dura( s varchar(20) default 'dura' );
|
||
recreate table test_mail( s varchar(20) default 'mail' );
|
||
recreate table test_omen( s varchar(20) default 'omen' );
|
||
recreate table test_opel( s varchar(20) default 'opel' );
|
||
recreate table test_rose( s varchar(20) default 'rose' );
|
||
recreate table test_win1( s varchar(20) default 'win1' );
|
||
recreate table test_won2( s varchar(20) default 'won2' );
|
||
recreate table test_w_n3( s varchar(20) default 'w_n3' );
|
||
commit;
|
||
|
||
recreate view v_test as
|
||
select v.s
|
||
from rdb$database r
|
||
left join (
|
||
select s from test_anna union all
|
||
select s from test_beta union all
|
||
select s from test_ciao union all
|
||
select s from test_cola union all
|
||
select s from test_dina union all
|
||
select s from test_doca union all
|
||
select s from test_docb union all
|
||
select s from test_docc union all
|
||
select s from test_dora union all
|
||
select s from test_dura union all
|
||
select s from test_mail union all
|
||
select s from test_omen union all
|
||
select s from test_opel union all
|
||
select s from test_rose union all
|
||
select s from test_win1 union all
|
||
select s from test_won2 union all
|
||
select s from test_w_n3
|
||
) v on 1=1
|
||
;
|
||
commit;
|
||
|
||
|
||
insert into test_anna default values;
|
||
insert into test_beta default values;
|
||
insert into test_ciao default values;
|
||
insert into test_cola default values;
|
||
insert into test_dina default values;
|
||
insert into test_doca default values;
|
||
insert into test_docb default values;
|
||
insert into test_docc default values;
|
||
insert into test_dora default values;
|
||
insert into test_dura default values;
|
||
insert into test_mail default values;
|
||
insert into test_omen default values;
|
||
insert into test_opel default values;
|
||
insert into test_rose default values;
|
||
insert into test_win1 default values;
|
||
insert into test_won2 default values;
|
||
insert into test_w_n3 default values;
|
||
commit;
|
||
|
||
"""
|
||
|
||
db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||
|
||
# test_script_1
|
||
#---
|
||
#
|
||
# import os
|
||
# import sys
|
||
# import time
|
||
#
|
||
# os.environ["ISC_USER"] = user_name
|
||
# os.environ["ISC_PASSWORD"] = user_password
|
||
#
|
||
# # dsn localhost/3400:C:\\FBTESTING\\qa
|
||
# bt-repo mpugs.core_NNNN.fdb
|
||
# # db_conn.database_name C:\\FBTESTING\\QA\\FBT-REPO\\TMP\\BUGS.CORE_NNNN.FDB
|
||
# # $(DATABASE_LOCATION)... C:/FBTESTING/qa/fbt-repo/tmp/bugs.core_NNN.fdb
|
||
#
|
||
# this_fdb=db_conn.database_name
|
||
# this_fbk=os.path.join(context['temp_directory'],'tmp_5538.fbk')
|
||
# test_res=os.path.join(context['temp_directory'],'tmp_5538.tmp')
|
||
#
|
||
# db_conn.close()
|
||
#
|
||
# ##############################################
|
||
# # Script for ISQL that will do 'heavy select':
|
||
#
|
||
# usr=user_name
|
||
# pwd=user_password
|
||
#
|
||
# # 1. Check that we can use patterns for include data only from several selected tables:
|
||
# incl_ptn_list = ('test_doc%', 'test_d(o|u)ra', '%_w(i|o|_)n[[:DIGIT:]]', 'test_a[[:ALPHA:]]{1,}a' )
|
||
#
|
||
# for i, p in enumerate(incl_ptn_list):
|
||
# runProgram('gbak',['-b', dsn, this_fbk, '-include', p ])
|
||
# runProgram('gbak',['-rep', this_fbk, 'localhost:'+test_res])
|
||
# sql_check = "set heading off; select %(i)s ptn_indx, q'{%(p)s}' as ptn_text, v.* from v_test v;" % locals()
|
||
# runProgram('isql',['localhost:'+test_res], sql_check )
|
||
#
|
||
# # 2. Check interaction between -INCLUDE_DATA and -SKIP_DATA switches for a table:
|
||
# # We must check only conditions marked by '**':
|
||
# # +--------------------------------------------------+
|
||
# # | | INCLUDE_DATA |
|
||
# # | |--------------------------------------|
|
||
# # | SKIP_DATA | NOT SET | MATCH | NOT MATCH |
|
||
# # +-----------+------------+------------+------------+
|
||
# # | NOT SET | included | included | excluded | <<< these rules can be skipped in this test
|
||
# # | MATCH | excluded |**excluded**|**excluded**|
|
||
# # | NOT MATCH | included |**included**|**excluded**|
|
||
# # +-----------+------------+------------+------------+
|
||
#
|
||
# skip_ptn = 'test_d(o|u)%'
|
||
# incl_ptn_list = ('test_d%', 'test_(a|b)[[:ALPHA:]]+a', )
|
||
#
|
||
# for i, p in enumerate(incl_ptn_list):
|
||
# runProgram('gbak',['-b', dsn, this_fbk, '-include_data', p, '-skip_data', skip_ptn ])
|
||
# runProgram('gbak',['-rep', this_fbk, 'localhost:'+test_res])
|
||
# sql_check = "set heading off; select %(i)s ptn_indx, q'{%(p)s}' as include_ptn, q'{%(skip_ptn)s}' as exclude_ptn, v.* from v_test v;" % locals()
|
||
# runProgram('isql',['localhost:'+test_res], sql_check )
|
||
#
|
||
# time.sleep(1)
|
||
# os.remove( this_fbk )
|
||
# os.remove( test_res )
|
||
#
|
||
#
|
||
#---
|
||
#act_1 = python_act('db_1', test_script_1, substitutions=substitutions_1)
|
||
|
||
expected_stdout_1 = """
|
||
0 test_doc% doca
|
||
0 test_doc% docb
|
||
0 test_doc% docc
|
||
1 test_d(o|u)ra dora
|
||
1 test_d(o|u)ra dura
|
||
2 %_w(i|o|_)n[[:DIGIT:]] win1
|
||
2 %_w(i|o|_)n[[:DIGIT:]] won2
|
||
2 %_w(i|o|_)n[[:DIGIT:]] w_n3
|
||
3 test_a[[:ALPHA:]]{1,}a anna
|
||
|
||
0 test_d% test_d(o|u)% dina
|
||
1 test_(a|b)[[:ALPHA:]]+a test_d(o|u)% anna
|
||
1 test_(a|b)[[:ALPHA:]]+a test_d(o|u)% beta
|
||
"""
|
||
|
||
@pytest.mark.version('>=4.0')
|
||
@pytest.mark.xfail
|
||
def test_1(db_1):
|
||
pytest.fail("Test not IMPLEMENTED")
|
||
|
||
|