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

Skip to content

Commit 02d41a6

Browse files
committed
Removing a hash function from api into utils package which is more suited for it.
1 parent d3396fe commit 02d41a6

5 files changed

Lines changed: 37 additions & 37 deletions

File tree

source/api/ut_runner.pkb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -265,37 +265,6 @@ create or replace package body ut_runner is
265265
end loop;
266266
end;
267267

268-
function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2 is
269-
l_start_pos pls_integer := 1;
270-
l_end_pos pls_integer := 1;
271-
l_result varchar2(4000);
272-
l_item varchar2(4000);
273-
l_at_end boolean := false;
274-
begin
275-
if a_random_seed is null then
276-
l_result := a_path;
277-
end if;
278-
if a_path is not null then
279-
loop
280-
l_end_pos := instr(a_path,'.',l_start_pos);
281-
if l_end_pos = 0 then
282-
l_end_pos := length(a_path)+1;
283-
l_at_end := true;
284-
end if;
285-
l_item := substr(a_path,l_start_pos,l_end_pos-l_start_pos);
286-
if l_item is not null then
287-
l_result :=
288-
l_result ||
289-
ut_utils.get_hash( to_char( dbms_utility.get_hash_value( l_item, 1, a_random_seed ) ) );
290-
end if;
291-
exit when l_at_end;
292-
l_result := l_result || chr(0);
293-
l_start_pos := l_end_pos + 1;
294-
end loop;
295-
end if;
296-
return l_result;
297-
end;
298-
299268
procedure coverage_start(a_coverage_run_id raw) is
300269
begin
301270
ut_coverage.coverage_start(a_coverage_run_id);

source/api/ut_runner.pks

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ create or replace package ut_runner authid current_user is
151151
*/
152152
function get_reporters_list return tt_reporters_info pipelined;
153153

154-
/*
155-
* Returns a hash value of suitepath based on input path and random seed
156-
*/
157-
function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2;
158-
159154
procedure coverage_start(a_coverage_run_id raw);
160155

161156
procedure coverage_stop;

source/core/ut_suite_cache_manager.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ create or replace package body ut_suite_cache_manager is
270270
extract_parent_child as (
271271
select s.path, substr(s.path,1,instr(s.path,'.',-1,1)-1) as parent_path,s.object_owner,
272272
case when a_random_seed is null then s.line_no else null end line_no,
273-
case when a_random_seed is null then null else ut_runner.hash_suite_path(s.path, a_random_seed) end random_seed
273+
case when a_random_seed is null then null else ut_utils.hash_suite_path(s.path, a_random_seed) end random_seed
274274
from table(a_suite_rows) s),
275275
t1(path,parent_path,object_owner,line_no,random_seed) as (
276276
--Anchor memeber

source/core/ut_utils.pkb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,37 @@ create or replace package body ut_utils is
892892
return case when a_data is null then null else dbms_crypto.hash(a_data, a_hash_type) end;
893893
end;
894894

895+
function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2 is
896+
l_start_pos pls_integer := 1;
897+
l_end_pos pls_integer := 1;
898+
l_result varchar2(4000);
899+
l_item varchar2(4000);
900+
l_at_end boolean := false;
901+
begin
902+
if a_random_seed is null then
903+
l_result := a_path;
904+
end if;
905+
if a_path is not null then
906+
loop
907+
l_end_pos := instr(a_path,'.',l_start_pos);
908+
if l_end_pos = 0 then
909+
l_end_pos := length(a_path)+1;
910+
l_at_end := true;
911+
end if;
912+
l_item := substr(a_path,l_start_pos,l_end_pos-l_start_pos);
913+
if l_item is not null then
914+
l_result :=
915+
l_result ||
916+
ut_utils.get_hash( to_char( dbms_utility.get_hash_value( l_item, 1, a_random_seed ) ) );
917+
end if;
918+
exit when l_at_end;
919+
l_result := l_result || chr(0);
920+
l_start_pos := l_end_pos + 1;
921+
end loop;
922+
end if;
923+
return l_result;
924+
end;
925+
895926
function qualified_sql_name(a_name varchar2) return varchar2 is
896927
begin
897928
return

source/core/ut_utils.pks

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ create or replace package ut_utils authid definer is
452452
*/
453453
function get_hash(a_data clob, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash;
454454

455+
/*
456+
* Returns a hash value of suitepath based on input path and random seed
457+
*/
458+
function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2;
459+
455460
/*
456461
* Verifies that the input string is a qualified SQL name using sys.dbms_assert.qualified_sql_name
457462
* If null value passed returns null

0 commit comments

Comments
 (0)