6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_5982_test.py

79 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-26 21:10:46 +01:00
"""
ID: issue-6234
ISSUE: 6234
TITLE: error read permission for BLOB field, when it is input/output procedure`s parametr
DESCRIPTION:
JIRA: CORE-5982
FBTEST: bugs.core_5982
2022-01-26 21:10:46 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
tmp_user = user_factory('db', name='tmp$c5982', password='123')
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set bail on;
2022-01-26 21:10:46 +01:00
recreate table my_table (
2021-04-26 20:07:00 +02:00
my_num integer
,my_data blob
);
commit;
insert into my_table(my_num , my_data) values (1, 'qwerty');
commit;
set term ^;
create or alter procedure sp_worker(my_data blob) as
declare variable my_value blob;
begin
my_value = my_data ;
rdb$set_context('USER_SESSION', 'SP_WORKER', 'DONE BY ' || current_user );
end
^
create or alter procedure sp_main as
declare variable my_data blob;
begin
select my_data
from my_table
where my_num = 1
into: my_data;
execute procedure sp_worker(my_data);
end
^
set term ;^
commit;
grant select on table my_table to procedure sp_main;
grant execute on procedure sp_worker to procedure sp_main;
grant execute on procedure sp_main to public;
commit;
set list on;
connect '$(DSN)' user 'tmp$c5982' password '123';
execute procedure sp_main;
select rdb$get_context('USER_SESSION', 'SP_WORKER') as result from rdb$database;
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
RESULT DONE BY TMP$C5982
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action, tmp_user):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout