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

Skip to content

Commit 41c007c

Browse files
committed
Removed grants:
- grant select, insert, update, delete on ut_compound_data_tmp - grant select, insert, update, delete on ut_compound_data_diff_tmp
1 parent c66b4d7 commit 41c007c

5 files changed

Lines changed: 37 additions & 31 deletions

File tree

source/create_grants.sql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
115115
--outputs
116116
grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user;
117117

118-
--user temp tables
119-
grant select, insert, update, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user;
120-
grant select, insert, update, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user;
121-
122-
--needed for selecting from annotation objects
118+
--needed internally for selecting from annotation objects within packages that use invoker rights
123119
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;
124120
grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user;
125121

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ create or replace package body ut_compound_data_helper is
3535
,x.data_id data_id
3636
,position + x.item_no item_no
3737
{:columns:}
38-
from {:ut3_owner:}.ut_compound_data_tmp x,
38+
from ut_compound_data_tmp x,
3939
xmltable('/ROWSET/ROW' passing x.item_data columns
4040
item_data xmltype path '*'
4141
,position for ordinality
@@ -53,7 +53,7 @@ create or replace package body ut_compound_data_helper is
5353
,x.data_id data_id
5454
,position + x.item_no item_no
5555
{:columns:}
56-
from {:ut3_owner:}.ut_compound_data_tmp x,
56+
from ut_compound_data_tmp x,
5757
xmltable('/ROWSET/ROW' passing x.item_data columns
5858
item_data xmltype path '*'
5959
,position for ordinality
@@ -207,10 +207,9 @@ create or replace package body ut_compound_data_helper is
207207
is
208208
l_alias varchar2(10) := a_alias;
209209
l_col_syntax varchar2(4000);
210-
l_ut_owner varchar2(250) := ut_utils.ut_owner;
211-
begin
210+
begin
212211
if a_data_info.is_sql_diffable = 0 then
213-
l_col_syntax := l_ut_owner ||'.ut_utils.get_hash('||l_alias||a_data_info.transformed_name||'.getClobVal()) as '||a_data_info.transformed_name ;
212+
l_col_syntax := 'ut_utils.get_hash('||l_alias||a_data_info.transformed_name||'.getClobVal()) as '||a_data_info.transformed_name ;
214213
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type = 'DATE' then
215214
l_col_syntax := 'to_date('||l_alias||a_data_info.transformed_name||') as '|| a_data_info.transformed_name;
216215
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('TIMESTAMP') then
@@ -334,7 +333,6 @@ create or replace package body ut_compound_data_helper is
334333
l_join_on_stmt clob;
335334
l_not_equal_stmt clob;
336335
l_where_stmt clob;
337-
l_ut_owner varchar2(250) := ut_utils.ut_owner;
338336
l_join_by_list ut_varchar2_list;
339337

340338
function get_join_type(a_inclusion_compare in boolean,a_negated in boolean) return varchar2 is
@@ -379,8 +377,7 @@ create or replace package body ut_compound_data_helper is
379377

380378
l_compare_sql := replace(l_compare_sql,'{:duplicate_number:}',l_partition_stmt);
381379
l_compare_sql := replace(l_compare_sql,'{:columns:}',l_select_stmt);
382-
l_compare_sql := replace(l_compare_sql,'{:ut3_owner:}',l_ut_owner);
383-
l_compare_sql := replace(l_compare_sql,'{:xml_to_columns:}',l_xmltable_stmt);
380+
l_compare_sql := replace(l_compare_sql,'{:xml_to_columns:}',l_xmltable_stmt);
384381
l_compare_sql := replace(l_compare_sql,'{:item_no:}',get_item_no(a_unordered));
385382
l_compare_sql := replace(l_compare_sql,'{:join_type:}',get_join_type(a_inclusion_type,a_is_negated));
386383
l_compare_sql := replace(l_compare_sql,'{:join_condition:}',l_join_on_stmt);
@@ -613,8 +610,28 @@ create or replace package body ut_compound_data_helper is
613610
ut_utils.remove_error_from_stack(sqlerrm,ut_utils.gc_xml_processing)||chr(10)||
614611
ut_expectation_processor.who_called_expectation(a_error_stack)||
615612
'Check the query and data for errors.';
616-
end;
617-
613+
end;
614+
615+
procedure save_cursor_data_for_diff(a_data_id raw, a_set_id integer, a_xml xmltype) is
616+
begin
617+
insert into ut_compound_data_tmp (data_id, item_no, item_data) values (a_data_id, a_set_id, a_xml);
618+
end;
619+
620+
function get_row_data_as_xml(a_data_id raw, a_max_rows integer) return ut_utils.t_clob_tab is
621+
l_results ut_utils.t_clob_tab;
622+
begin
623+
select xmlserialize( content ucd.item_data no indent)
624+
bulk collect into l_results
625+
from ut_compound_data_tmp tmp
626+
,xmltable ( '/ROWSET' passing tmp.item_data
627+
columns item_data xmltype PATH '*'
628+
) ucd
629+
where tmp.data_id = a_data_id
630+
and rownum <= a_max_rows;
631+
632+
return l_results;
633+
end;
634+
618635
function type_no_length ( a_type_name varchar2) return boolean is
619636
begin
620637
return case

source/expectations/data_values/ut_compound_data_helper.pks

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ create or replace package ut_compound_data_helper authid definer is
115115
function get_compare_cursor(a_diff_cursor_text in clob,a_self_id raw, a_other_id raw) return sys_refcursor;
116116

117117
function create_err_cursor_msg(a_error_stack varchar2) return varchar2;
118+
119+
procedure save_cursor_data_for_diff(a_data_id raw, a_set_id integer, a_xml xmltype);
120+
121+
function get_row_data_as_xml(a_data_id raw, a_max_rows integer) return ut_utils.t_clob_tab;
118122

119123
/*
120124
* Function to return true or false if the type dont have an length

source/expectations/data_values/ut_compound_data_value.tpb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,10 @@ create or replace type body ut_compound_data_value as
4444
if not self.is_null() then
4545
dbms_lob.createtemporary(l_result, true);
4646
ut_utils.append_to_clob(l_result,'Data:'||chr(10));
47-
--return first c_max_rows rows
48-
execute immediate '
49-
select xmlserialize( content ucd.item_data no indent)
50-
from '|| ut_utils.ut_owner ||q'[.ut_compound_data_tmp tmp
51-
,xmltable ( '/ROWSET' passing tmp.item_data
52-
columns item_data xmltype PATH '*'
53-
) ucd
54-
where tmp.data_id = :data_id
55-
and rownum <= :max_rows]'
56-
bulk collect into l_results using self.data_id, ut_utils.gc_diff_max_rows;
57-
58-
ut_utils.append_to_clob(l_result,l_results);
47+
ut_utils.append_to_clob(
48+
l_result,
49+
ut_compound_data_helper.get_row_data_as_xml( self.data_id, ut_utils.gc_diff_max_rows )
50+
);
5951

6052
l_result_string := ut_utils.to_string(l_result,null);
6153
dbms_lob.freetemporary(l_result);

source/expectations/data_values/ut_data_value_refcursor.tpb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ create or replace type body ut_data_value_refcursor as
5858
null;
5959
$end
6060
l_elements_count := l_elements_count + dbms_xmlgen.getNumRowsProcessed(l_ctx);
61-
execute immediate
62-
'insert into ' || l_ut_owner || '.ut_compound_data_tmp(data_id, item_no, item_data) ' ||
63-
'values (:self_guid, :self_row_count, :l_xml)'
64-
using in self.data_id, l_set_id, l_xml;
61+
ut_compound_data_helper.save_cursor_data_for_diff( self.data_id, l_set_id, l_xml );
6562
l_set_id := l_set_id + c_bulk_rows;
6663
end loop;
6764

0 commit comments

Comments
 (0)