@@ -20,70 +20,6 @@ create or replace package body ut_suite_cache_manager is
2020 * Private code
2121 */
2222
23- gc_get_cache_suite_sql constant varchar2(32767) :=
24- q'[with
25- suite_items as (
26- select /*+ cardinality(c 500) */ value(c) as obj
27- from ut_suite_cache c
28- where 1 = 1
29- and c.object_owner = :l_object_owner
30- and ( {:path:}
31- and {:object_name:}
32- and {:procedure_name:}
33- )
34- )
35- ),
36- {:tags:}
37- suitepaths as (
38- select distinct substr(c.obj.path,1,instr(c.obj.path,'.',-1)-1) as suitepath,
39- c.obj.path as path,
40- c.obj.object_owner as object_owner
41- from {:suite_item_name:} c
42- where c.obj.self_type = 'UT_SUITE'
43- ),
44- gen as (
45- select rownum as pos
46- from xmltable('1 to 20')
47- ),
48- suitepath_part AS (
49- select distinct
50- substr(b.suitepath, 1, instr(b.suitepath || '.', '.', 1, g.pos) -1) as path,
51- object_owner
52- from suitepaths b
53- join gen g
54- on g.pos <= regexp_count(b.suitepath, '\w+')
55- ),
56- logical_suite_data as (
57- select 'UT_LOGICAL_SUITE' as self_type, p.path, p.object_owner,
58- upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name,
59- cast(null as ut_executables) as x,
60- cast(null as ut_varchar2_rows) as y,
61- cast(null as ut_executable_test) as z
62- from suitepath_part p
63- where p.path
64- not in (select s.path from suitepaths s)
65- ),
66- logical_suites as (
67- select ut_suite_cache_row(
68- null,
69- s.self_type, s.path, s.object_owner, s.object_name,
70- s.object_name, null, null, null, null, 0,null,
71- ut_varchar2_rows(),
72- s.x, s.x, s.x, s.x, s.x, s.x,
73- s.y, null, s.z
74- ) as obj
75- from logical_suite_data s
76- ),
77- items as (
78- select obj from {:suite_item_name:}
79- union all
80- select obj from logical_suites
81- )
82- select /*+ no_parallel */ c.obj
83- from items c
84- order by c.obj.object_owner,{:random_seed:}]';
85-
86-
8723 gc_get_bulk_cache_suite_sql constant varchar2(32767) :=
8824 q'[with
8925 suite_items as (
@@ -157,61 +93,6 @@ create or replace package body ut_suite_cache_manager is
15793 return l_result;
15894 end;
15995
160-
161- function get_path_sql(a_path in varchar2) return varchar2 is
162- begin
163- return case when a_path is not null then q'[
164- :l_path||'.' like c.path || '.%' /*all parents and self*/
165- or ( c.path||'.' like :l_path || '.%' /*all children and self*/
166- ]'
167- else ' :l_path is null and ( :l_path is null ' end;
168- end;
169-
170- function get_object_name_sql(a_object_name in varchar2) return varchar2 is
171- begin
172- return case when a_object_name is not null
173- then ' c.object_name = :a_object_name '
174- else ' :a_object_name is null' end;
175- end;
176-
177- function get_procedure_name_sql(a_procedure_name in varchar2) return varchar2 is
178- begin
179- return case when a_procedure_name is not null
180- then ' c.name = :a_procedure_name'
181- else ' :a_procedure_name is null' end;
182- end;
183-
184- function get_tags_sql(a_tags_count in integer) return varchar2 is
185- begin
186- return case when a_tags_count > 0 then
187- q'[included_tags as (
188- select c.obj.path as path
189- from suite_items c
190- where c.obj.tags multiset intersect :a_include_tag_list is not empty or :a_include_tag_list is empty
191- ),
192- excluded_tags as (
193- select c.obj.path as path
194- from suite_items c
195- where c.obj.tags multiset intersect :a_exclude_tag_list is not empty
196- ),
197- suite_items_tags as (
198- select c.*
199- from suite_items c
200- where exists (
201- select 1 from included_tags t
202- where t.path||'.' like c.obj.path || '.%' /*all parents and self*/
203- or c.obj.path||'.' like t.path || '.%' /*all children and self*/
204- )
205- and not exists (
206- select 1 from excluded_tags t
207- where c.obj.path||'.' like t.path || '.%' /*all children and self*/
208- )
209- ),]'
210- else
211- q'[dummy as (select 'x' from dual where :a_include_tag_list is null and :a_include_tag_list is null and :a_exclude_tag_list is null),]'
212- end;
213- end;
214-
21596 function get_random_seed_sql(a_random_seed positive) return varchar2 is
21697 begin
21798 return case
@@ -269,70 +150,6 @@ create or replace package body ut_suite_cache_manager is
269150 return l_results;
270151 end;
271152
272-
273-
274- /*
275- * Public code
276- */
277- function get_cached_suite_rows(
278- a_object_owner varchar2,
279- a_path varchar2 := null,
280- a_object_name varchar2 := null,
281- a_procedure_name varchar2 := null,
282- a_random_seed positive := null,
283- a_tags ut_varchar2_rows := null
284- ) return ut_suite_cache_rows is
285- l_path varchar2(4000);
286- l_results ut_suite_cache_rows := ut_suite_cache_rows();
287- l_sql varchar2(32767);
288- l_suite_item_name varchar2(20);
289- l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows());
290- l_include_tags ut_varchar2_rows;
291- l_exclude_tags ut_varchar2_rows;
292- l_object_owner varchar2(250) := ut_utils.qualified_sql_name(a_object_owner);
293- l_object_name varchar2(250) := ut_utils.qualified_sql_name(a_object_name);
294- l_procedure_name varchar2(250) := ut_utils.qualified_sql_name(a_procedure_name);
295- begin
296-
297- select /*+ no_parallel */ column_value
298- bulk collect into l_include_tags
299- from table(l_tags)
300- where column_value not like '-%';
301-
302- select /*+ no_parallel */ ltrim(column_value,'-')
303- bulk collect into l_exclude_tags
304- from table(l_tags)
305- where column_value like '-%';
306-
307- if a_path is null and a_object_name is not null then
308- select /*+ no_parallel */ min(c.path)
309- into l_path
310- from ut_suite_cache c
311- where c.object_owner = upper(l_object_owner)
312- and c.object_name = upper(l_object_name)
313- and c.name = nvl(upper(l_procedure_name), c.name);
314- else
315- l_path := lower(ut_utils.qualified_sql_name(a_path));
316- end if;
317- l_suite_item_name := case when l_tags.count > 0 then 'suite_items_tags' else 'suite_items' end;
318-
319- l_sql := gc_get_cache_suite_sql;
320- l_sql := replace(l_sql,'{:suite_item_name:}',l_suite_item_name);
321- l_sql := replace(l_sql,'{:object_owner:}',upper(l_object_owner));
322- l_sql := replace(l_sql,'{:path:}',get_path_sql(l_path));
323- l_sql := replace(l_sql,'{:object_name:}',get_object_name_sql(l_object_name));
324- l_sql := replace(l_sql,'{:procedure_name:}',get_procedure_name_sql(l_procedure_name));
325- l_sql := replace(l_sql,'{:tags:}',get_tags_sql(l_tags.count));
326- l_sql := replace(l_sql,'{:random_seed:}',get_random_seed_sql(a_random_seed));
327-
328- ut_event_manager.trigger_event(ut_event_manager.gc_debug, ut_key_anyvalues().put('l_sql',l_sql) );
329-
330- execute immediate l_sql
331- bulk collect into l_results
332- using upper(l_object_owner), l_path, l_path, upper(a_object_name), upper(a_procedure_name), l_include_tags, l_include_tags, l_exclude_tags, a_random_seed;
333- return l_results;
334- end;
335-
336153 function expand_paths(a_schema_paths ut_path_items) return ut_path_items is
337154 l_schema_paths ut_path_items:= ut_path_items();
338155 begin
@@ -371,17 +188,9 @@ create or replace package body ut_suite_cache_manager is
371188 row_number() over ( partition by schema_name,object_name,procedure_name,suite_path order by 1) r_num
372189 from paths_to_expand)
373190 where r_num = 1 ;
374-
375-
376-
377191 return l_schema_paths;
378192 end;
379-
380- function get_schema_paths(a_paths in ut_varchar2_list) return ut_path_items is
381- begin
382- return expand_paths(group_paths_by_schema(a_paths));
383- end;
384-
193+
385194 function get_suite_items (
386195 a_schema_paths ut_path_items
387196 ) return ut_suite_cache_rows is
@@ -451,6 +260,33 @@ create or replace package body ut_suite_cache_manager is
451260 return l_suite_tags;
452261 end;
453262
263+ /*
264+ * Public code
265+ */
266+
267+ function get_schema_paths(a_paths in ut_varchar2_list) return ut_path_items is
268+ begin
269+ return expand_paths(group_paths_by_schema(a_paths));
270+ end;
271+
272+ function get_cached_suite_rows(
273+ a_object_owner varchar2,
274+ a_path varchar2 := null,
275+ a_object_name varchar2 := null,
276+ a_procedure_name varchar2 := null,
277+ a_random_seed positive := null,
278+ a_tags ut_varchar2_rows := null
279+ ) return ut_suite_cache_rows is
280+ l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows());
281+ l_object_owner varchar2(250) := ut_utils.qualified_sql_name(a_object_owner);
282+ l_object_name varchar2(250) := ut_utils.qualified_sql_name(a_object_name);
283+ l_procedure_name varchar2(250) := ut_utils.qualified_sql_name(a_procedure_name);
284+ l_schema_paths ut_path_items;
285+ begin
286+ l_schema_paths := ut_path_items(ut_path_item(a_object_owner,a_object_name,a_procedure_name,a_path));
287+ return get_cached_suite_rows(l_schema_paths,a_random_seed,l_tags);
288+ end;
289+
454290 function get_cached_suite_rows(
455291 a_schema_paths ut_path_items,
456292 a_random_seed positive := null,
0 commit comments