6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_2796_test.py

62 lines
1.6 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-3186
ISSUE: 3186
TITLE: DB_KEY is always zero for external tables
DESCRIPTION:
NOTES:
!!! IMPORTANT !!!
This test requires config ExternalFileAccess = Full
JIRA: CORE-2796
FBTEST: bugs.core_2796
2022-01-21 18:49:26 +01:00
"""
2021-10-21 19:29:23 +02:00
2021-04-26 20:07:00 +02:00
import pytest
2022-01-21 18:49:26 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table ext_test external file '$(DATABASE_LOCATION)c2796.dat' (col char(24), lf char(1));
set list on;
set term ^;
execute block returns (ms_diff bigint)
as
declare dbkey char(8) character set octets;
declare v_dts1 timestamp;
begin
v_dts1=cast('now' as timestamp);
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
insert into ext_test values( :v_dts1, ascii_char(10));
insert into ext_test values( :v_dts1-rand()*100, ascii_char(10));
2021-10-21 19:29:23 +02:00
2021-04-26 20:07:00 +02:00
select rdb$db_key from ext_test order by col desc rows 1 into :dbkey;
2021-10-21 19:29:23 +02:00
2021-04-26 20:07:00 +02:00
for
select datediff(millisecond from cast(col as timestamp) to :v_dts1)
from ext_test
where rdb$db_key = :dbkey
into ms_diff
do
suspend;
2021-10-21 19:29:23 +02:00
end
2021-04-26 20:07:00 +02:00
^
set term ;^
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
MS_DIFF 0
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-21 18:49:26 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00