Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2fb8b2

Browse files
authored
Merge pull request #628 from utPLSQL/feature/fixes_to_reporter_list
Fixed issue when user executing tests doesn't have access to DBA_TYPES view
2 parents db0d2dc + 0a00fd8 commit a2fb8b2

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

source/api/ut_runner.pkb

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,38 +144,34 @@ create or replace package body ut_runner is
144144
return;
145145
end;
146146

147-
function get_reporters_list return tt_reporters_info pipelined
148-
AS
147+
function get_reporters_list return tt_reporters_info pipelined is
149148
l_cursor sys_refcursor;
150-
l_owner varchar2(128) := ut_utils.ut_owner();
149+
l_owner varchar2(128) := upper(ut_utils.ut_owner());
151150
l_results tt_reporters_info;
152151
c_bulk_limit constant integer := 10;
153-
begin
154-
open l_cursor for 'SELECT
155-
owner || ''.'' || type_name,
156-
CASE
157-
WHEN sys_connect_by_path(owner
158-
|| ''.''
159-
|| type_name,'','') LIKE ''%' || l_owner || '''
160-
|| ''.UT_OUTPUT_REPORTER_BASE%'' THEN ''Y''
161-
ELSE ''N''
162-
END
163-
is_output_reporter
164-
FROM dba_types t
165-
WHERE instantiable = ''YES''
166-
CONNECT BY supertype_name = PRIOR type_name AND supertype_owner = PRIOR owner
167-
START WITH type_name = ''UT_REPORTER_BASE'' AND owner = '''|| l_owner || '''';
168-
loop
169-
fetch l_cursor bulk collect into l_results limit c_bulk_limit;
170-
for i in 1 .. l_results.count loop
171-
pipe row (l_results(i));
172-
end loop;
173-
exit when l_cursor%notfound;
152+
l_view_name varchar2(200) := ut_metadata.get_dba_view('dba_types');
153+
begin
154+
open l_cursor for q'[
155+
SELECT
156+
owner || '.' || type_name,
157+
CASE
158+
WHEN sys_connect_by_path(owner||'.'||type_name,',') LIKE '%]' || l_owner || q'[.UT_OUTPUT_REPORTER_BASE%'
159+
THEN 'Y'
160+
ELSE 'N'
161+
END is_output_reporter
162+
FROM ]'||l_view_name||q'[ t
163+
WHERE instantiable = 'YES'
164+
CONNECT BY supertype_name = PRIOR type_name AND supertype_owner = PRIOR owner
165+
START WITH type_name = 'UT_REPORTER_BASE' AND owner = ']'|| l_owner || '''';
166+
loop
167+
fetch l_cursor bulk collect into l_results limit c_bulk_limit;
168+
for i in 1 .. l_results.count loop
169+
pipe row (l_results(i));
174170
end loop;
175-
close l_cursor;
176-
end;
177-
178-
171+
exit when l_cursor%notfound;
172+
end loop;
173+
close l_cursor;
174+
end;
179175

180176
end ut_runner;
181177
/

source/create_synonyms_and_grants_for_public.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ grant execute on &&ut3_owner..ut_varchar2_rows to public;
6161
grant execute on &&ut3_owner..ut_integer_list to public;
6262
grant execute on &&ut3_owner..ut_reporter_base to public;
6363
grant execute on &&ut3_owner..ut_output_reporter_base to public;
64+
grant execute on &&ut3_owner..ut_coverage_reporter_base to public;
65+
grant execute on &&ut3_owner..ut_console_reporter_base to public;
6466
grant execute on &&ut3_owner..ut_coverage to public;
6567
grant execute on &&ut3_owner..ut_coverage_options to public;
6668
grant execute on &&ut3_owner..ut_coverage_helper to public;

source/create_synonyms_and_grants_for_user.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user;
8181
grant execute on &&ut3_owner..ut_integer_list to &ut3_user;
8282
grant execute on &&ut3_owner..ut_reporter_base to &ut3_user;
8383
grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
84+
grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user;
85+
grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user;
8486
grant execute on &&ut3_owner..ut_coverage to &ut3_user;
8587
grant execute on &&ut3_owner..ut_coverage_options to &ut3_user;
8688
grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user;

0 commit comments

Comments
 (0)