Hi there,
in our company, we are using functions being implemented externally in C resulting in code like this:
FUNCTION MyFunc
( vcPar1 IN VARCHAR2
, vcPar2 IN VARCHAR2
)
RETURN BINARY_INTEGER
AS EXTERNAL LIBRARY our_lib NAME "ext_my_func"
PARAMETERS
( vcPar1 STRING, vcPar1 INDICATOR
, vcPar2 STRING, vcPar2 INDICATOR
)
LANGUAGE c;
PLDoc then crashing saying ugly things like:
PLDoc version: 1.5.5
ParseException at package <sql xyz_body.sql="">: net.sourceforge.pldoc.parser.ParseException: Encountered " "LANGUAGE" "LANGUAGE "" at line 566, column 1.
Was expecting one of:
";" ...
"WITH" ...
"LIBRARY" ...
"NAME" ...
"PARAMETERS" ...
Last consumed token: ")"
net.sourceforge.pldoc.parser.ParseException: Encountered " "LANGUAGE" "LANGUAGE "" at line 566, column 1.
Was expecting one of:
";" ...
"WITH" ...
"LIBRARY" ...
"NAME" ...
"PARAMETERS" ...
at net.sourceforge.pldoc.parser.PLSQLParser.generateParseException(PLSQLParser.java:38946) at net.sourceforge.pldoc.parser.PLSQLParser.jj_consume_token(PLSQLParser.java:38792) at net.sourceforge.pldoc.parser.PLSQLParser.programUnit(PLSQLParser.java:7660) at net.sourceforge.pldoc.parser.PLSQLParser.declarativeUnit(PLSQLParser.java:3180) at net.sourceforge.pldoc.parser.PLSQLParser.declarativeSection(PLSQLParser.java:3576) at net.sourceforge.pldoc.parser.PLSQLParser.packageBody(PLSQLParser.java:2516) at net.sourceforge.pldoc.parser.PLSQLParser.input(PLSQLParser.java:734) at net.sourceforge.pldoc.PLDoc.processPackage(PLDoc.java:719) at net.sourceforge.pldoc.PLDoc.run(PLDoc.java:248) at net.sourceforge.pldoc.PLDoc.main(PLDoc.java:160)
Package sql/xyz_body.sql skipped.
Would be cool if you guys could implement support for stuff like this.
Thanks!
I think that the parser is meant to cope with it - I will have a look
I won't be able to do code changes - I a limited an iPhone and iPad
It looks as if the parser expects the LANGUAGE clause at the start
Goto
http://sourceforge.net/p/pldoc/code/781/tree/pldoc/trunk/src/main/javacc/concat/PLSQL.jj?format=raw then search for <LANGUAGE>.
What database version?
Our database version is Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit.
I found a bit of time to try a few things. I can't say I understand the code you linked above too well, but I think the keywords Library and Language contradict each other. Anyhow, I couldn't get this to work as no matter where I place the Language part, I get errors. Not to mention that the code above was fine for the db and therefor should be fine for PLDoc as well, I'd say. BTW: this is not time critical for us as we didn't have any automated documentation for years now, so it wouldn't matter to wait with it another month or so.
I did a quick google and found - your syntax.
It is valid but seems to have been deprecated since (at the latest) Oracle 8i, which is why the parser didn't like it.
I couldn't find any Oracle syntax diagram, but found some examples - support will be hit and miss.
I am using the following syntax now:
FUNCTION foo
( param1 IN VARCHAR2
, param2 IN VARCHAR2
)
RETURN BINARY_INTEGER
AS LANGUAGE C LIBRARY my_lib NAME "foo_c"
PARAMETERS
( ...
);
This seems to work with PLDoc (works also if the declaration of the lib and the actual c function is swapped). This is okay for me, but I think this should be documented somehow as otherwise others may step into the same trap.