Issue Details (XML | Word | Printable)

Key: DERBY-475
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Daniel John Debrunner
Reporter: Daniel John Debrunner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Add a system function mechanism and table of functions, including a set of initial functions.

Created: 28/Jul/05 07:22 AM   Updated: 10/Sep/07 10:08 AM
Return to search
Component/s: SQL
Affects Version/s: None
Fix Version/s: 10.2.1.6

Time Tracking:
Not Specified

Issue Links:
Reference
 
dependent
 

Resolution Date: 03/Feb/06 04:55 AM


 Description  « Hide
Add a mechanism for system functions to be easily added. Resolution of functions will check SYSFUN.<name> for a function call in SQL when the function is not qualified by a schema. If the current schema does not have a function matching the name, then an additional resolution is made using SYSFUN.<name>.

Add a table driven mechanism for simple single argument functions (could be expanded in the future).

Add these functions

/*
** SYSFUN functions
*[0] = FUNCTION name
*[1] = RETURNS type
*[2] = Java class
*[3] = method name
*[4] = parameter type (single parameter)
*
*/
private static final String[][] SYSFUN_FUNCTIONS = {
{"ACOS", "DOUBLE", "java.lang.Math", "acos", "DOUBLE"},
{"ASIN", "DOUBLE", "java.lang.Math", "asin", "DOUBLE"},
{"ATAN", "DOUBLE", "java.lang.Math", "atan", "DOUBLE"},
{"COS", "DOUBLE", "java.lang.Math", "cos", "DOUBLE"},
{"SIN", "DOUBLE", "java.lang.Math", "sin", "DOUBLE"},
{"TAN", "DOUBLE", "java.lang.Math", "tan", "DOUBLE"},
{"DEGREES", "DOUBLE", "java.lang.Math", "toDegrees", "DOUBLE"},
{"RADIANS", "DOUBLE", "java.lang.Math", "toRadians", "DOUBLE"},
{"LN", "DOUBLE", "java.lang.Math", "log", "DOUBLE"},
{"EXP", "DOUBLE", "java.lang.Math", "exp", "DOUBLE"},
{"CEIL", "DOUBLE", "java.lang.Math", "ceil", "DOUBLE"},
{"CEILING", "DOUBLE", "java.lang.Math", "ceil", "DOUBLE"},
{"FLOOR", "DOUBLE", "java.lang.Math", "floor", "DOUBLE"},

};

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Daniel John Debrunner added a comment - 30/Jul/05 11:42 PM
Committed revision 226528.
Table added to DataDictionaryImpl with the set of functions above and tests in functions.sql.
Other single argument functions can be easily added through this mechanism.

Daniel John Debrunner added a comment - 30/Jan/06 11:26 AM
These new match functions should use the methods in the class java.lang.StrictMath instead of java.lang.Math. Provides consistent/portable behaviour across different JVMs.

Daniel John Debrunner added a comment - 03/Feb/06 04:55 AM
Complete set of functions added is:

ACOS, ASIN, ATAN, COS, SIN, TAN, PI
DEGREES, RADIANS, EXP, LN, LOG, LOG10, CEIL, CEILING, FLOOR