Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue with style check.
Reorganized code to avoid problems with conditional compilation on 12.2 for triggers.
  • Loading branch information
jgebal committed Jun 10, 2019
commit 56803f7f32235a21168af2869079b1929b0375ac
4 changes: 2 additions & 2 deletions development/utplsql_style_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ select i.name, i.type, i.object_name, i.object_type, i.usage, i.line, i.col, cou
and i.usage_context_id = p.usage_id
where i.type like 'VARIABLE' and i.usage = 'DECLARATION'
and i.object_type not in ('TYPE')
and (i.name not like 'L#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR')
or i.name not like 'G#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR'))
and (i.name not like 'L#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR','TRIGGER')
or i.name not like 'G#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR','TRIGGER'))
and p.type != 'RECORD'
order by object_name, object_type, line, col
;
Expand Down
21 changes: 17 additions & 4 deletions source/core/annotations/ut_annotation_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,10 @@ create or replace package body ut_annotation_manager as
end;

procedure trigger_obj_annotation_rebuild is
l_sql_text ora_name_list_t;
l_parts binary_integer;
l_object_to_parse ut_annotation_obj_cache_info;
l_sql_text ora_name_list_t;
l_parts binary_integer;
l_object_to_parse ut_annotation_obj_cache_info;
l_restricted_users ora_name_list_t;

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
l_sql_clob clob;
Expand Down Expand Up @@ -291,9 +292,21 @@ create or replace package body ut_annotation_manager as
using a_object_name, a_object_type, a_object_owner, a_object_name;
return l_result;
end;

begin
if ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE') then
$if dbms_db_version.version < 12 $then
l_restricted_users := ora_name_list_t(
'ANONYMOUS','APPQOSSYS','AUDSYS','DBSFWUSER','DBSNMP','DIP','GGSYS','GSMADMIN_INTERNAL',
'GSMCATUSER','GSMUSER','ORACLE_OCM','OUTLN','REMOTE_SCHEDULER_AGENT','SYS','SYS$UMF',
'SYSBACKUP','SYSDG','SYSKM','SYSRAC','SYSTEM','WMSYS','XDB','XS$NULL');
$else
select username bulk collect into l_restricted_users
from all_users where oracle_maintained = 'Y';
$end
if ora_dict_obj_owner member of l_restricted_users then
return;
end if;

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

Expand Down
19 changes: 3 additions & 16 deletions source/core/annotations/ut_trigger_annotation_parsing.trg
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
create or replace trigger ut_trigger_annotation_parsing
after create or alter or drop
on database
declare
l_restricted_users ora_name_list_t;
begin
if (ora_dict_obj_owner = UPPER('&&UT3_OWNER')
and ora_dict_obj_name = 'UT3_TRIGGER_ALIVE'
and ora_dict_obj_type = 'SYNONYM')
then
execute immediate 'begin ut_trigger_check.is_alive(); end;';
elsif ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE') then
$if dbms_db_version.version < 12 $then
l_restricted_users := ora_name_list_t(
'ANONYMOUS','APPQOSSYS','AUDSYS','DBSFWUSER','DBSNMP','DIP','GGSYS','GSMADMIN_INTERNAL',
'GSMCATUSER','GSMUSER','ORACLE_OCM','OUTLN','REMOTE_SCHEDULER_AGENT','SYS','SYS$UMF',
'SYSBACKUP','SYSDG','SYSKM','SYSRAC','SYSTEM','WMSYS','XDB','XS$NULL');
$else
select /*+ result_cache */ username bulk collect into l_restricted_users
from all_users where oracle_maintained = 'Y';
$end
if not (ora_dict_obj_type = 'TYPE' and ora_dict_obj_name like 'SYS\_PLSQL\_%' escape '\')
and not ora_dict_obj_owner member of l_restricted_users
then
elsif ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE')
and not (ora_dict_obj_type = 'TYPE' and ora_dict_obj_name like 'SYS\_PLSQL\_%' escape '\')
then
execute immediate 'begin ut_annotation_manager.trigger_obj_annotation_rebuild; end;';
end if;
end if;
exception
when others then null;
Expand Down