-
Notifications
You must be signed in to change notification settings - Fork 182
/
ut_coverage_helper.pkb
89 lines (72 loc) · 2.56 KB
/
ut_coverage_helper.pkb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
create or replace package body ut_coverage_helper is
/*
utPLSQL - Version 3
Copyright 2016 - 2018 utPLSQL Project
Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
type t_proftab_row is record (
line binary_integer,
calls number(38,0)
);
type t_proftab_rows is table of t_proftab_row;
type t_block_row is record(
line binary_integer
,blocks binary_integer
,covered_blocks binary_integer);
type t_block_rows is table of t_block_row;
procedure insert_into_tmp_table(a_data t_coverage_sources_tmp_rows) is
begin
forall i in 1 .. a_data.count
insert into ut_coverage_sources_tmp
(full_name,owner,name,line,text, to_be_skipped)
values(a_data(i).full_name,a_data(i).owner,a_data(i).name,a_data(i).line,a_data(i).text,a_data(i).to_be_skipped);
end;
procedure cleanup_tmp_table is
pragma autonomous_transaction;
begin
null;
execute immediate 'truncate table ut_coverage_sources_tmp$';
commit;
end;
function is_tmp_table_populated return boolean is
l_result integer;
begin
select 1 into l_result from ut_coverage_sources_tmp where rownum = 1;
return (l_result = 1);
exception
when no_data_found then
return false;
end;
function get_tmp_table_objects_cursor return t_tmp_table_objects_crsr is
l_result t_tmp_table_objects_crsr;
begin
open l_result for
select o.owner, o.name, o.full_name, max(o.line) lines_count,
cast(
collect(decode(to_be_skipped, 'Y', to_char(line))) as ut_varchar2_list
) to_be_skipped_list
from ut_coverage_sources_tmp o
group by o.owner, o.name, o.full_name;
return l_result;
end;
function get_tmp_table_object_lines(a_owner varchar2, a_object_name varchar2) return ut_varchar2_list is
l_result ut_varchar2_list;
begin
select rtrim(s.text,chr(10)) text
bulk collect into l_result
from ut_coverage_sources_tmp s
where s.owner = a_owner
and s.name = a_object_name
order by s.line;
return l_result;
end;
end;
/