generateCreateFunctionStatements
Generate automatically the CREATE FUNCTION statements for all the extended utilities packaged with J/Foundation.
Returns a String of CREATE FUNCTION/PROCEDURE statements for all built-in Java UDRs. These examples can be taken as is and executed inside of a database to register the Java function. Any LVARCHAR value can be substituted with CHAR/VACHAR/or LVARCHAR(size to 32000) depending on your needs.
The overload function takes in the fully quality package + class name and generates CREATE FUNCTION/PROCEDURE statements for all methods in a class you have added to J/Foundation directly via the JVPCLASSPATH in your ONCONFIG file.
Setup
Syntax
CREATE FUNCTION generateCreateFunctionStatements() RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.JFoundation.generateCreateFunctionStatements()' LANGUAGE JAVA; CREATE FUNCTION generateCreateFunctionStatements(LVARCHAR) RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.JFoundation.generateCreateFunctionStatements()' LANGUAGE JAVA; GRANT EXECUTE ON FUNCTION generateCreateFunctionStatements() TO PUBLIC; GRANT EXECUTE ON FUNCTION generateCreateFunctionStatements(LVARCHAR) TO PUBLIC;
Usage
> EXECUTE FUNCTION generateCreateFunctionStatements(); (expression) | -------------------- ... -- com.informix.judrs.Explain CREATE FUNCTION getExplain(LVARCHAR) RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.Explain.getExplain(java.lang.String)' LANGUAGE JAVA; -- com.informix.judrs.IfxStrings CREATE FUNCTION replaceAll(LVARCHAR, LVARCHAR, LVARCHAR) RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.IfxStrings.replaceAll(java.lang.String,java.lang.String,java.la ng.String)' LANGUAGE JAVA; CREATE FUNCTION encodeBase64(BLOB) RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.IfxStrings.encodeBase64(java.sql.Blob)' LANGUAGE JAVA; CREATE FUNCTION getUUID() RETURNS LVARCHAR EXTERNAL NAME 'com.informix.judrs.IfxStrings.getUUID()' LANGUAGE JAVA; ...