[
https://issues.apache.org/jira/browse/DERBY-3069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531561
]
Rick Hillegas commented on DERBY-3069:
--------------------------------------
Here's a stab at a functional spec for this behavior:
User Experience:
1) Functions and Procedures (with fixed numbers of arguments) can resolve to
Java methods with varargs signatures when Derby runs on Java 5 or higher.
2) Does NOT allow varargs in the SQL declaration of the arguments of Functions
and Procedures.
Method Resolution Details:
The method resolution rules for SQL invoked routines are described in the SQL
Standard, part 13, section 8.6. We change the resolution rules given in Rule 3,
case b, step 4, case 1. More specifically, we expand JCS to include additional
candidate methods. The additional methods obey the following rules.
Let the number of arguments in JPDL be SQLArgCount. Let Candidate be a method
which satisfies the following:
aa) Candidate is a visible Java method in class JCLSN in Jar JN with method
name JMN.
bb) Candidate has CandidateArgCount arguments in its signature. The last
argument in that signature is a vararg argument of type T.
cc) The first CandidateArgCount-1 arguments of JPDL have the types of the first
CandidateArgCount-1 arguments of Candidate.
dd) If SQLArgCount == CandidateArgCount-1, then Candidate is added to JCS.
ee) If SQLArgCount >= CandidateArgCount and all of the arguments in JPDL from
CandidateArgCount onward have type T, then Candidate is added to JCS.
> Derby does not resolve functions bound to methods with varargs.
> ---------------------------------------------------------------
>
> Key: DERBY-3069
> URL: https://issues.apache.org/jira/browse/DERBY-3069
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1,
> 10.2.1.6, 10.2.2.0, 10.3.1.4
> Reporter: Rick Hillegas
> Assignee: Rick Hillegas
> Attachments: derby-3069-01-varargs-aa.diff,
> derby-3069-01-varargs-ab.diff, z.java, z.sql
>
>
> Varargs were added in Java 5. It would be nice if Derby let you invoke a
> function bound to a method with a variable length argument list. The
> Reference Guide states a small number of restrictions for methods which can
> be invoked as Derby functions: They must be public, static, and not have
> arguments which are long datatypes. I see no reason that Derby shouldn't be
> able to resolve and invoke functions which are bound to methods which don't
> suffer these limitations but which have variable argument lists.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.