Skip to content

Commit 56803f7

Browse files
committed
Fixed issue with style check.
Reorganized code to avoid problems with conditional compilation on 12.2 for triggers.
1 parent 8f6d6c2 commit 56803f7

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

development/utplsql_style_check.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ select i.name, i.type, i.object_name, i.object_type, i.usage, i.line, i.col, cou
4040
and i.usage_context_id = p.usage_id
4141
where i.type like 'VARIABLE' and i.usage = 'DECLARATION'
4242
and i.object_type not in ('TYPE')
43-
and (i.name not like 'L#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR')
44-
or i.name not like 'G#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR'))
43+
and (i.name not like 'L#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR','TRIGGER')
44+
or i.name not like 'G#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR','TRIGGER'))
4545
and p.type != 'RECORD'
4646
order by object_name, object_type, line, col
4747
;

source/core/annotations/ut_annotation_manager.pkb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ create or replace package body ut_annotation_manager as
255255
end;
256256

257257
procedure trigger_obj_annotation_rebuild is
258-
l_sql_text ora_name_list_t;
259-
l_parts binary_integer;
260-
l_object_to_parse ut_annotation_obj_cache_info;
258+
l_sql_text ora_name_list_t;
259+
l_parts binary_integer;
260+
l_object_to_parse ut_annotation_obj_cache_info;
261+
l_restricted_users ora_name_list_t;
261262

262263
function get_source_from_sql_text(a_object_name varchar2, a_sql_text ora_name_list_t, a_parts binary_integer) return sys_refcursor is
263264
l_sql_clob clob;
@@ -291,9 +292,21 @@ create or replace package body ut_annotation_manager as
291292
using a_object_name, a_object_type, a_object_owner, a_object_name;
292293
return l_result;
293294
end;
294-
295+
295296
begin
296297
if ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE') then
298+
$if dbms_db_version.version < 12 $then
299+
l_restricted_users := ora_name_list_t(
300+
'ANONYMOUS','APPQOSSYS','AUDSYS','DBSFWUSER','DBSNMP','DIP','GGSYS','GSMADMIN_INTERNAL',
301+
'GSMCATUSER','GSMUSER','ORACLE_OCM','OUTLN','REMOTE_SCHEDULER_AGENT','SYS','SYS$UMF',
302+
'SYSBACKUP','SYSDG','SYSKM','SYSRAC','SYSTEM','WMSYS','XDB','XS$NULL');
303+
$else
304+
select username bulk collect into l_restricted_users
305+
from all_users where oracle_maintained = 'Y';
306+
$end
307+
if ora_dict_obj_owner member of l_restricted_users then
308+
return;
309+
end if;
297310

298311
l_object_to_parse := ut_annotation_obj_cache_info(ora_dict_obj_owner, ora_dict_obj_name, ora_dict_obj_type, 'Y');
299312

source/core/annotations/ut_trigger_annotation_parsing.trg

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
create or replace trigger ut_trigger_annotation_parsing
22
after create or alter or drop
33
on database
4-
declare
5-
l_restricted_users ora_name_list_t;
64
begin
75
if (ora_dict_obj_owner = UPPER('&&UT3_OWNER')
86
and ora_dict_obj_name = 'UT3_TRIGGER_ALIVE'
97
and ora_dict_obj_type = 'SYNONYM')
108
then
119
execute immediate 'begin ut_trigger_check.is_alive(); end;';
12-
elsif ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE') then
13-
$if dbms_db_version.version < 12 $then
14-
l_restricted_users := ora_name_list_t(
15-
'ANONYMOUS','APPQOSSYS','AUDSYS','DBSFWUSER','DBSNMP','DIP','GGSYS','GSMADMIN_INTERNAL',
16-
'GSMCATUSER','GSMUSER','ORACLE_OCM','OUTLN','REMOTE_SCHEDULER_AGENT','SYS','SYS$UMF',
17-
'SYSBACKUP','SYSDG','SYSKM','SYSRAC','SYSTEM','WMSYS','XDB','XS$NULL');
18-
$else
19-
select /*+ result_cache */ username bulk collect into l_restricted_users
20-
from all_users where oracle_maintained = 'Y';
21-
$end
22-
if not (ora_dict_obj_type = 'TYPE' and ora_dict_obj_name like 'SYS\_PLSQL\_%' escape '\')
23-
and not ora_dict_obj_owner member of l_restricted_users
24-
then
10+
elsif ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE')
11+
and not (ora_dict_obj_type = 'TYPE' and ora_dict_obj_name like 'SYS\_PLSQL\_%' escape '\')
12+
then
2513
execute immediate 'begin ut_annotation_manager.trigger_obj_annotation_rebuild; end;';
26-
end if;
2714
end if;
2815
exception
2916
when others then null;

0 commit comments

Comments
 (0)