#
# BSD-style license; for more info see http://pmd.sourceforge.net/license.html
#

#Added for PLDoc/PMD (Source Code)

driver=oracle.jdbc.OracleDriver

languages=plsql,java
sourcecodetypes=PROCEDURE,FUNCTION,TRIGGER,PACKAGE,PACKAGE_BODY,TYPE_SPEC,TYPE_BODY

#Return source code as CLOB
getSourceCodeStatement=BEGIN\
\n  DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES', FALSE);\
\n  DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'CONSTRAINTS', FALSE);\
\n  DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA. SESSION_TRANSFORM,'SQLTERMINATOR',true );\
\n  :1 := DBMS_METADATA.GET_DDL( :2 ,      :3 ,      :4 ,  'COMPATIBLE', 'ORACLE', 'DDL' )  ;\
\nEND;


#java.sql.Types.CLOB http://docs.oracle.com/javase/6/docs/api/constant-values.html#java.sql.Types.CLOB
returnType=2005

#Filter using DatabaseMetaData.getProcedures match expressions (standard SQL wildcards '%' and '_') 
#sourceCodeObjects.getString("PROCEDURE_SCHEM")
#sourceCodeObjects.getString("PROCEDURE_TYPE")
#sourceCodeObjects.getString("PROCEDURE_NAME")
getSourceObjectsStatement=SELECT owner PROCEDURE_SCHEM, REPLACE(DECODE(object_type,'PACKAGE','PACKAGE_SPEC','TYPE','TYPE_SPEC',object_type),' ','_')  PROCEDURE_TYPE, object_name PROCEDURE_NAME, null version \
\nFROM dba_objects \
\nWHERE DECODE(UPPER(:1) , '%', '%', DECODE(object_type, 'PROCEDURE', 'PLSQL','PACKAGE', 'PLSQL','PACKAGE BODY', 'PLSQL','TYPE BODY', 'PLSQL','TRIGGER', 'PLSQL','FUNCTION', 'PLSQL','TYPE','PLSQL','JAVA SOURCE','JAVA'), 'MATCH' ) IS NOT NULL \
\nAND owner LIKE :2 \
\nAND object_type LIKE :3 \
\nAND object_name LIKE :4

