-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f3a8e2
commit 6976d5b
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
'id': 'bugs.core_4928', | ||
'qmid': None, | ||
'tracker_id': 'CORE-4928', | ||
'title': 'It is not possible to save the connection information in the ON CONNECT trigger, if the connection is created by the gbak', | ||
'description': '', | ||
'min_versions': '3.0', | ||
'versions': [ | ||
{ | ||
'firebird_version': '3.0', | ||
'platform': 'All', | ||
'init_script': | ||
""" | ||
recreate table att_log (att_id int, att_name varchar(50), att_user varchar(31), att_addr varchar(25), att_prot varchar(15), att_auth varchar(15), att_dts timestamp default 'now'); | ||
|
||
commit; | ||
|
||
set term ^; | ||
create or alter trigger trg_connect active on connect as | ||
begin | ||
in autonomous transaction do | ||
insert into att_log(att_id, att_name, att_user, att_addr, att_prot, att_auth) | ||
select | ||
mon$attachment_id | ||
,mon$attachment_name | ||
,mon$user | ||
,mon$remote_address | ||
,mon$remote_protocol | ||
,mon$auth_method | ||
from mon$attachments | ||
--where mon$attachment_id = current_connection | ||
; | ||
end | ||
^ | ||
set term ;^ | ||
commit; | ||
""", | ||
'test_type': 'Python', | ||
'test_script': | ||
"""\ | ||
import os | ||
db_conn.close() | ||
fbk = os.path.join(context['temp_directory'],'tmp.core_4928.fbk') | ||
runProgram('gbak',['-b','-user',user_name,'-password',user_password,dsn,fbk]) | ||
runProgram('gbak',['-rep','-user',user_name,'-password',user_password,fbk,dsn]) | ||
|
||
sql=''' | ||
set list on; | ||
select | ||
iif( att_id > 0, 1, 0) is_att_id_ok | ||
,iif( att_name containing 'core_4928.fdb', 1, 0) is_att_name_ok | ||
,iif( att_user containing 'SYSDBA', 1, 0) is_att_user_ok | ||
,iif( att_addr is not null, 1, 0) is_att_addr_ok | ||
,iif( upper(att_prot) starting with upper('TCP'), 1, 0) is_att_prot_ok | ||
,iif( att_auth is not null, 1, 0) is_att_auth_ok | ||
,iif( att_dts is not null, 1, 0) is_att_dts_ok | ||
from att_log | ||
where att_id <> current_connection; | ||
''' | ||
runProgram('isql',[dsn,'-user',user_name,'-pas',user_password],sql) | ||
|
||
if os.path.isfile(fbk): | ||
os.remove(fbk) | ||
""" | ||
, | ||
'expected_stdout': | ||
""" | ||
IS_ATT_ID_OK 1 | ||
IS_ATT_NAME_OK 1 | ||
IS_ATT_USER_OK 1 | ||
IS_ATT_ADDR_OK 1 | ||
IS_ATT_PROT_OK 1 | ||
IS_ATT_AUTH_OK 1 | ||
IS_ATT_DTS_OK 1 | ||
""", | ||
'expected_stderr': | ||
""" | ||
""" | ||
} | ||
] | ||
} |