@@ -19,37 +19,37 @@ create or replace package body ut_annotation_manager as
1919 ------------------------------
2020 --private definitions
2121
22- -- function get_missing_objects(a_object_owner varchar2, a_object_type varchar2) return ut_annotation_objs_cache_info is
23- -- l_rows sys_refcursor;
24- -- l_ut_owner varchar2(250) := ut_utils.ut_owner;
25- -- l_objects_view varchar2(200) := ut_metadata.get_dba_view('dba_objects');
26- -- l_cursor_text varchar2(32767);
27- -- l_result ut_annotation_objs_cache_info;
28- -- begin
29- -- l_cursor_text :=
30- -- q'[select ]'||l_ut_owner||q'[.ut_annotation_obj_cache_info(
31- -- object_owner => i.object_owner,
32- -- object_name => i.object_name,
33- -- object_type => i.object_type,
34- -- needs_refresh => null
35- -- )
36- -- from ]'||l_ut_owner||q'[.ut_annotation_cache_info i
37- -- where
38- -- not exists (
39- -- select 1 from ]'||l_objects_view||q'[ o
40- -- where o.owner = i.object_owner
41- -- and o.object_name = i.object_name
42- -- and o.object_type = i.object_type
43- -- and o.owner = :a_object_owner
44- -- and o.object_type = :a_object_type
45- -- )
46- -- and i.object_owner = :a_object_owner
47- -- and i.object_type = :a_object_type]';
48- -- open l_rows for l_cursor_text using a_object_owner, a_object_type, a_object_owner, a_object_type;
49- -- fetch l_rows bulk collect into l_result limit 1000000;
50- -- close l_rows;
51- -- return l_result;
52- -- end;
22+ function get_missing_objects(a_object_owner varchar2, a_object_type varchar2) return ut_annotation_objs_cache_info is
23+ l_rows sys_refcursor;
24+ l_ut_owner varchar2(250) := ut_utils.ut_owner;
25+ l_objects_view varchar2(200) := ut_metadata.get_dba_view('dba_objects');
26+ l_cursor_text varchar2(32767);
27+ l_result ut_annotation_objs_cache_info;
28+ begin
29+ l_cursor_text :=
30+ q'[select ]'||l_ut_owner||q'[.ut_annotation_obj_cache_info(
31+ object_owner => i.object_owner,
32+ object_name => i.object_name,
33+ object_type => i.object_type,
34+ needs_refresh => null
35+ )
36+ from ]'||l_ut_owner||q'[.ut_annotation_cache_info i
37+ where
38+ not exists (
39+ select 1 from ]'||l_objects_view||q'[ o
40+ where o.owner = i.object_owner
41+ and o.object_name = i.object_name
42+ and o.object_type = i.object_type
43+ and o.owner = :a_object_owner
44+ and o.object_type = :a_object_type
45+ )
46+ and i.object_owner = :a_object_owner
47+ and i.object_type = :a_object_type]';
48+ open l_rows for l_cursor_text using a_object_owner, a_object_type, a_object_owner, a_object_type;
49+ fetch l_rows bulk collect into l_result limit 1000000;
50+ close l_rows;
51+ return l_result;
52+ end;
5353
5454 function get_annotation_objs_info(a_object_owner varchar2, a_object_type varchar2, a_parse_date timestamp := null) return ut_annotation_objs_cache_info is
5555 l_rows sys_refcursor;
@@ -60,36 +60,25 @@ create or replace package body ut_annotation_manager as
6060 begin
6161 l_cursor_text :=
6262 q'[select ]'||l_ut_owner||q'[.ut_annotation_obj_cache_info(
63- object_owner => nvl( o.owner, i.object_owner ),
64- object_name => nvl( o.object_name, i.object_name ),
65- object_type => nvl( o.object_type, i.object_type ),
66- needs_refresh =>
67- case
68- when o.last_ddl_time < cast(i.parse_time as date) then 'N'
69- when o.owner is null then null
70- else 'Y'
71- end
63+ object_owner => o.owner,
64+ object_name => o.object_name,
65+ object_type => o.object_type,
66+ needs_refresh => case when o.last_ddl_time < cast(i.parse_time as date) then 'N' else 'Y' end
7267 )
73- from (
74- select * from ]'||l_objects_view||q'[ o
75- where o.owner = :a_object_owner
76- and o.object_type = :a_object_type
77- ) o
78- full outer join (
79- select * from ]'||l_ut_owner||q'[.ut_annotation_cache_info i
80- where i.object_owner = :a_object_owner
81- and i.object_type = :a_object_type
82- ) i
68+ from ]'||l_objects_view||q'[ o
69+ left join ]'||l_ut_owner||q'[.ut_annotation_cache_info i
8370 on o.owner = i.object_owner
8471 and o.object_name = i.object_name
8572 and o.object_type = i.object_type
86- where ]'
87- || case
73+ where o.owner = ']'||a_object_owner||q'['
74+ and o.object_type = ']'||a_object_type||q'['
75+ and ]'
76+ || case
8877 when a_parse_date is null
89- then ':a_parse_date is null'
90- else 'o.last_ddl_time >= cast(:a_parse_date as date) or o.last_ddl_time is null '
91- end;
92- open l_rows for l_cursor_text using a_object_owner, a_object_type, a_object_owner, a_object_type, a_parse_date;
78+ then ':a_parse_date is null'
79+ else 'o.last_ddl_time >= cast(:a_parse_date as date)'
80+ end;
81+ open l_rows for l_cursor_text using a_parse_date;
9382 fetch l_rows bulk collect into l_result limit 1000000;
9483 close l_rows;
9584 return l_result;
@@ -197,7 +186,6 @@ create or replace package body ut_annotation_manager as
197186 a_info_rows ut_annotation_objs_cache_info
198187 ) is
199188 l_objects_to_parse ut_annotation_objs_cache_info;
200- l_objects_to_remove ut_annotation_objs_cache_info;
201189 begin
202190 select value(x)bulk collect into l_objects_to_parse
203191 from table(a_info_rows) x where x.needs_refresh = 'Y';
@@ -208,13 +196,9 @@ create or replace package body ut_annotation_manager as
208196 or ut_metadata.is_object_visible('ut3.ut_utils')
209197 or ut_metadata.is_object_visible('dba_objects')
210198 then
211- select value(x)bulk collect into l_objects_to_remove
212- from table(a_info_rows) x where x.needs_refresh is null;
213-
214- ut_annotation_cache_manager.remove_from_cache(l_objects_to_remove);
215- -- ut_annotation_cache_manager.remove_from_cache(
216- -- get_missing_objects(a_object_owner, a_object_type)
217- -- );
199+ ut_annotation_cache_manager.remove_from_cache(
200+ get_missing_objects(a_object_owner, a_object_type)
201+ );
218202 end if;
219203
220204 --if some source needs parsing and putting into cache
0 commit comments