@@ -38,15 +38,15 @@ create or replace package body ut_coverage is
3838 function get_cov_sources_sql(a_coverage_options ut_coverage_options) return varchar2 is
3939 l_result varchar2(32767);
4040 l_full_name varchar2(32767);
41- l_mappings varchar2(32767);
41+ l_join_mappings varchar2(32767);
4242 l_filters varchar2(32767);
4343 l_mappings_cardinality integer := 0;
4444 begin
4545 l_result := q'[
4646 with sources as (
4747 select /*+ cardinality(f {mappings_cardinality}) */
4848 {l_full_name} as full_name, s.owner, s.name, s.line, s.text
49- from {sources_view} s {file_mappings }
49+ from {sources_view} s {join_file_mappings }
5050 where s.type in ('PACKAGE BODY', 'TYPE BODY', 'PROCEDURE', 'FUNCTION')
5151 {filters}
5252 ),
@@ -62,7 +62,7 @@ create or replace package body ut_coverage is
6262 and regexp_like( t.text, '[A-Za-z0-9$#_]*(begin|declare|compound).*', 'i' )
6363 ) as line,
6464 s.text
65- from {sources_view} s {file_mappings }
65+ from {sources_view} s {join_file_mappings }
6666 where s.type = 'TRIGGER'
6767 {filters}
6868 ),
@@ -100,7 +100,7 @@ create or replace package body ut_coverage is
100100 if a_coverage_options.file_mappings is not empty then
101101 l_mappings_cardinality := ut_utils.scale_cardinality(cardinality(a_coverage_options.file_mappings));
102102 l_full_name := 'f.file_name';
103- l_mappings := '
103+ l_join_mappings := '
104104 join table(:file_mappings) f
105105 on s.name = f.object_name
106106 and s.type = f.object_type
@@ -117,73 +117,12 @@ create or replace package body ut_coverage is
117117
118118 l_result := replace(l_result, '{sources_view}', ut_metadata.get_source_view_name());
119119 l_result := replace(l_result, '{l_full_name}', l_full_name);
120- l_result := replace(l_result, '{file_mappings }', l_mappings );
120+ l_result := replace(l_result, '{join_file_mappings }', l_join_mappings );
121121 l_result := replace(l_result, '{filters}', l_filters);
122122 l_result := replace(l_result, '{mappings_cardinality}', l_mappings_cardinality);
123123
124124 return l_result;
125125
126- -- if a_coverage_options.file_mappings is not null and a_coverage_options.file_mappings.count > 0 then
127- -- l_full_name := 'f.file_name';
128- -- else
129- -- l_full_name := 'lower(s.owner||''.''||s.name)';
130- -- end if;
131- -- l_result := '
132- -- select full_name, owner, name, line, to_be_skipped, text
133- -- from (
134- -- select '||l_full_name||q'[ as full_name,
135- -- s.owner,
136- -- s.name,
137- -- s.line -
138- -- coalesce(
139- -- case when type!='TRIGGER' then 0 end,
140- -- (select min(t.line) - 1
141- -- from ]'||ut_metadata.get_source_view_name()||q'[ t
142- -- where t.owner = s.owner and t.type = s.type and t.name = s.name
143- -- and regexp_like( t.text, '[A-Za-z0-9$#_]*(begin|declare|compound).*','i'))
144- -- ) as line,
145- -- s.text, ]';
146- -- l_result := l_result ||
147- -- q'[case
148- -- when
149- -- -- to avoid execution of regexp_like on every line
150- -- -- first do a rough check for existence of search pattern keyword
151- -- (lower(s.text) like '%procedure%'
152- -- or lower(s.text) like '%function%'
153- -- or lower(s.text) like '%begin%'
154- -- or lower(s.text) like '%end%'
155- -- or lower(s.text) like '%package%'
156- -- ) and
157- -- regexp_like(
158- -- s.text,
159- -- '^([\t ]*(((not)?\s*(overriding|final|instantiable)[\t ]*)*(static|constructor|member)?[\t ]*(procedure|function)|package([\t ]+body)|begin|end([\t ]+\S+)*[ \t]*;))', 'i'
160- -- )
161- -- then 'Y'
162- -- end as to_be_skipped ]';
163- --
164- -- l_result := l_result ||' from '||ut_metadata.get_source_view_name()||q'[ s]';
165- --
166- -- if a_coverage_options.file_mappings is not empty then
167- -- l_result := l_result || '
168- -- join table(:file_mappings) f
169- -- on s.name = f.object_name
170- -- and s.type = f.object_type
171- -- and s.owner = f.object_owner
172- -- where 1 = 1';
173- -- elsif a_coverage_options.include_objects is not empty then
174- -- l_result := l_result || '
175- -- where (s.owner, s.name) in (select il.owner, il.name from table(:include_objects) il)';
176- -- else
177- -- l_result := l_result || '
178- -- where s.owner in (select upper(t.column_value) from table(:l_schema_names) t)';
179- -- end if;
180- -- l_result := l_result || q'[
181- -- and s.type not in ('PACKAGE', 'TYPE', 'JAVA SOURCE')
182- -- --Exclude calls to utPLSQL framework, Unit Test packages and objects from a_exclude_list parameter of coverage reporter
183- -- and (s.owner, s.name) not in (select el.owner, el.name from table(:l_skipped_objects) el)
184- -- )
185- -- where line > 0]';
186- -- return l_result;
187126 end;
188127
189128 function get_cov_sources_cursor(a_coverage_options in ut_coverage_options,a_sql in varchar2) return sys_refcursor is
0 commit comments