Skip to content

Commit e5b996a

Browse files
do not restrict includables to the current user
use a hard-coded list of oracle_maintained_users based on 18.3
1 parent 93ca218 commit e5b996a

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,17 @@ class UtplsqlDao {
609609
* gets dependencies of a given object.
610610
*
611611
* The result can be used as input for the includeObjectList in htmlCodeCoverage
612-
* The scope is reduced to the current schema.
613-
* This is useful when test packages are installed in the code schema.
612+
* The scope is reduced to non-oracle maintained schemas.
613+
*
614+
* Oracle introduced the column ORACLE_MAINTAINED in 12.1.
615+
* To simplify the query and compatibility the result of the following
616+
* query is included
617+
*
618+
* SELECT '''' || listagg(username, ''', ''') || '''' AS oracle_maintained_users
619+
* FROM dba_users
620+
* WHERE oracle_maintained = 'Y'
621+
* ORDER BY username;
622+
*
614623
* The result may include test packages
615624
*
616625
* @param name test package name
@@ -622,7 +631,15 @@ class UtplsqlDao {
622631
from «IF dbaViewAccessible»dba«ELSE»all«ENDIF»_dependencies
623632
WHERE owner = user
624633
AND name = upper(?)
625-
AND referenced_owner = user
634+
AND referenced_owner NOT IN (
635+
'SYS', 'SYSTEM', 'XS$NULL', 'OJVMSYS', 'LBACSYS', 'OUTLN', 'SYS$UMF',
636+
'DBSNMP', 'APPQOSSYS', 'DBSFWUSER', 'GGSYS', 'ANONYMOUS', 'CTXSYS',
637+
'SI_INFORMTN_SCHEMA', 'DVF', 'DVSYS', 'GSMADMIN_INTERNAL', 'ORDPLUGINS',
638+
'MDSYS', 'OLAPSYS', 'ORDDATA', 'XDB', 'WMSYS', 'ORDSYS', 'GSMCATUSER',
639+
'MDDATA', 'REMOTE_SCHEDULER_AGENT', 'SYSBACKUP', 'GSMUSER', 'APEX_PUBLIC_USER',
640+
'SYSRAC', 'AUDSYS', 'DIP', 'SYSKM', 'ORACLE_OCM', 'APEX_INSTANCE_ADMIN_USER',
641+
'SYSDG', 'FLOWS_FILES', 'ORDS_METADATA', 'ORDS_PUBLIC_USER', 'APEX_180100'
642+
)
626643
AND referenced_type IN ('PACKAGE', 'TYPE', 'PROCEDURE', 'FUNCTION', 'TRIGGER')
627644
'''
628645
val jdbcTemplate = new JdbcTemplate(new SingleConnectionDataSource(conn, true))

sqldev/src/test/java/org/utplsql/sqldev/tests/DalTest.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class DalTest extends AbstractJdbcTest {
359359
val actualEmpty = dao.includes('TEST_F1')
360360
Assert.assertEquals(#[], actualEmpty)
361361
val actual = dao.includes('junit_utplsql_test_pkg')
362-
Assert.assertEquals(#['JUNIT_UTPLSQL_TEST_PKG','JUNIT_F'], actual)
362+
Assert.assertEquals(#['JUNIT_UTPLSQL_TEST_PKG','JUNIT_F','UT_EXPECTATION'], actual)
363363
}
364364

365365
}

0 commit comments

Comments
 (0)