2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
"""
|
|
|
|
ID: tabloid.eqc-136030
|
|
|
|
TITLE: Check ability for preparing and then run query with parameters. Query should use ORDER-BY clause.
|
|
|
|
DESCRIPTION:
|
|
|
|
NOTES:
|
2022-05-26 10:48:56 +02:00
|
|
|
[02.02.2019] pzotov
|
2022-02-04 19:05:19 +01:00
|
|
|
removed from DB metadata calls to UDFs - they are not used in this test but can not be used in FB 4.0 by default.
|
|
|
|
Removed triggers because they have no deal here.
|
2022-05-26 10:48:56 +02:00
|
|
|
[26.05.2022] pzotov
|
|
|
|
Re-implemented for work in firebird-qa suite.
|
|
|
|
Checked on: 3.0.8.33535, 4.0.1.2692, 5.0.0.497
|
2022-02-04 19:05:19 +01:00
|
|
|
FBTEST: functional.tabloid.eqc_136030
|
2022-05-26 10:48:56 +02:00
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
import pytest
|
2022-05-26 10:48:56 +02:00
|
|
|
import zipfile
|
|
|
|
from pathlib import Path
|
2022-02-04 19:05:19 +01:00
|
|
|
from firebird.qa import *
|
2022-05-26 10:48:56 +02:00
|
|
|
from firebird.driver import SrvRestoreFlag
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-02-04 19:05:19 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
INPUT message field count: 2
|
|
|
|
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 4 charset: 0 NONE
|
2022-02-04 19:05:19 +01:00
|
|
|
: name: alias:
|
|
|
|
: table: owner:
|
2021-04-26 20:07:00 +02:00
|
|
|
02: sqltype: 448 VARYING scale: 0 subtype: 0 len: 2 charset: 0 NONE
|
2022-02-04 19:05:19 +01:00
|
|
|
: name: alias:
|
|
|
|
: table: owner:
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
PLAN JOIN (JOIN (A ORDER DOCGIO_PK, B NATURAL), C NATURAL)
|
|
|
|
|
|
|
|
OUTPUT message field count: 15
|
|
|
|
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 4 charset: 0 NONE
|
|
|
|
: name: CSOC alias: CSOC
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
02: sqltype: 448 VARYING scale: 0 subtype: 0 len: 2 charset: 0 NONE
|
|
|
|
: name: NRESERC alias: NRESERC
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
03: sqltype: 448 VARYING scale: 0 subtype: 0 len: 3 charset: 0 NONE
|
|
|
|
: name: CODDOC alias: CODDOC
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
04: sqltype: 448 VARYING scale: 0 subtype: 0 len: 3 charset: 0 NONE
|
|
|
|
: name: CODGIO alias: CODGIO
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
05: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 30 charset: 0 NONE
|
|
|
|
: name: MACCHINA alias: MACCHINA
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
06: sqltype: 510 TIMESTAMP scale: 0 subtype: 0 len: 8
|
|
|
|
: name: REC_UPD alias: REC_UPD
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
07: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
|
|
|
|
: name: UTENTE_UPD alias: UTENTE_UPD
|
|
|
|
: table: DOCGIO owner: SYSDBA
|
|
|
|
08: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
|
|
|
|
: name: CAST alias: FBLC
|
2022-02-04 19:05:19 +01:00
|
|
|
: table: owner:
|
2021-04-26 20:07:00 +02:00
|
|
|
09: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
|
|
|
|
: name: CAST alias: FDEL
|
2022-02-04 19:05:19 +01:00
|
|
|
: table: owner:
|
2021-04-26 20:07:00 +02:00
|
|
|
10: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 3 charset: 0 NONE
|
|
|
|
: name: TIPDOC alias: TIPDOC
|
|
|
|
: table: DOCTIP owner: SYSDBA
|
|
|
|
11: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 60 charset: 0 NONE
|
|
|
|
: name: DESDOC alias: DESDOC
|
|
|
|
: table: DOCTIP owner: SYSDBA
|
|
|
|
12: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 1 charset: 0 NONE
|
|
|
|
: name: FBLC alias: FBLC
|
|
|
|
: table: DOCTIP owner: SYSDBA
|
|
|
|
13: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 3 charset: 0 NONE
|
|
|
|
: name: TIPGIO alias: TIPGIO
|
|
|
|
: table: GIOTIP owner: SYSDBA
|
|
|
|
14: sqltype: 448 VARYING Nullable scale: 0 subtype: 0 len: 60 charset: 0 NONE
|
|
|
|
: name: DESGIO alias: DESGIO
|
|
|
|
: table: GIOTIP owner: SYSDBA
|
|
|
|
15: sqltype: 452 TEXT Nullable scale: 0 subtype: 0 len: 1 charset: 0 NONE
|
|
|
|
: name: FBLC alias: FBLC
|
|
|
|
: table: GIOTIP owner: SYSDBA
|
|
|
|
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC AUT
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC CGE
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC CTI
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FAA
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FAV
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FTA
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FTV
|
|
|
|
CODGIO CGB
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FAA
|
|
|
|
CODGIO RAC
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FTA
|
|
|
|
CODGIO RAC
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC NCA
|
|
|
|
CODGIO RAC
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC NDA
|
|
|
|
CODGIO RAC
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FAV
|
|
|
|
CODGIO RFV
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC FTV
|
|
|
|
CODGIO RFV
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
|
|
|
|
|
|
|
CSOC DEM1
|
2022-02-04 19:05:19 +01:00
|
|
|
NRESERC
|
2021-04-26 20:07:00 +02:00
|
|
|
CODDOC NCV
|
|
|
|
CODGIO RFV
|
|
|
|
MACCHINA VAIO-ADAL
|
|
|
|
REC_UPD 2007-06-17 22:50:41.0000
|
|
|
|
UTENTE_UPD 1
|
|
|
|
FBLC 0
|
|
|
|
FDEL 0
|
|
|
|
TIPDOC <null>
|
|
|
|
DESDOC <null>
|
|
|
|
FBLC <null>
|
|
|
|
TIPGIO <null>
|
|
|
|
DESGIO <null>
|
|
|
|
FBLC <null>
|
2021-12-22 20:25:10 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-05-26 10:48:56 +02:00
|
|
|
fbk_file = temp_file('tmp_eqc_136030.fbk')
|
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-05-26 10:48:56 +02:00
|
|
|
def test_1(act: Action, fbk_file: Path, capsys):
|
|
|
|
zipped_fbk_file = zipfile.Path(act.files_dir / 'eqc136030.zip', at='eqc136030.fbk')
|
|
|
|
fbk_file.write_bytes(zipped_fbk_file.read_bytes())
|
|
|
|
with act.connect_server() as srv:
|
|
|
|
srv.database.restore(database=act.db.db_path, backup=fbk_file, flags=SrvRestoreFlag.REPLACE)
|
|
|
|
srv.wait()
|
|
|
|
|
|
|
|
script = """
|
|
|
|
set list on;
|
|
|
|
set sqlda_display on;
|
|
|
|
set planonly;
|
|
|
|
|
|
|
|
select
|
|
|
|
a.csoc, a.nreserc , a.coddoc , a.codgio ,
|
|
|
|
a.macchina, a.rec_upd, a.utente_upd,
|
|
|
|
cast(a.fblc as integer) fblc,
|
|
|
|
cast(a.fdel as integer) fdel,
|
|
|
|
b.tipdoc, b.desdoc, b.fblc , c.tipgio, c.desgio , c.fblc
|
|
|
|
from docgio a
|
|
|
|
left join doctip (a.csoc, a.nreserc) b on ( a.coddoc = b.coddoc )
|
|
|
|
left join giotip (a.csoc, a.nreserc) c on (a.codgio = c.codgio)
|
|
|
|
where
|
|
|
|
a.csoc = ?
|
|
|
|
and a.nreserc = ?
|
|
|
|
order by a.codgio, a.coddoc;
|
|
|
|
|
|
|
|
set planonly;
|
|
|
|
set plan off;
|
|
|
|
set sqlda_display off;
|
|
|
|
|
|
|
|
select
|
|
|
|
a.csoc, a.nreserc , a.coddoc , a.codgio ,
|
|
|
|
a.macchina, a.rec_upd, a.utente_upd,
|
|
|
|
cast(a.fblc as integer) fblc,
|
|
|
|
cast(a.fdel as integer) fdel,
|
|
|
|
b.tipdoc, b.desdoc, b.fblc , c.tipgio, c.desgio , c.fblc
|
|
|
|
from docgio a
|
|
|
|
left join doctip (a.csoc, a.nreserc) b on ( a.coddoc = b.coddoc )
|
|
|
|
left join giotip (a.csoc, a.nreserc) c on (a.codgio = c.codgio)
|
|
|
|
where
|
|
|
|
a.csoc = 'DEM1' -- :csoc
|
|
|
|
and a.nreserc = '' -- :nreserc
|
|
|
|
order by a.codgio, a.coddoc;
|
|
|
|
"""
|
|
|
|
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.isql(switches=[], input = script, combine_output=True)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-05-26 10:48:56 +02:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|