db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-183) Parameter names required in CREATE FUNCTION
Date Sat, 14 Oct 2006 16:31:38 GMT
    [ http://issues.apache.org/jira/browse/DERBY-183?page=comments#action_12442313 ] 
            
Bryan Pendleton commented on DERBY-183:
---------------------------------------

I believe that RoutineAliasInfo.getParameterNames()[n] will return the empty string.

It's a bit hard to figure this out directly, because I couldn't figure out how that method
would get called from, say, an SQL statement.

However, I looked at this indirectly by running dblook against a database which had
some functions with unnamed parameters, and the output of dblook was as follows:

CREATE FUNCTION "APP"."NONAME1" ( INTEGER, INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER
STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

CREATE FUNCTION "APP"."NONAME2" (P1 INTEGER, INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER
STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

By examining how RoutineAliasInfo.toString works, it seems that if the parameterNames
array held NULL for the unnamed parameters, then dblook would have generated:

CREATE FUNCTION "APP"."NONAME1" (NULL INTEGER,NULL INTEGER) RETURNS INTEGER LANGUAGE JAVA
PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max'
;

CREATE FUNCTION "APP"."NONAME2" (P1 INTEGER,NULL INTEGER) RETURNS INTEGER LANGUAGE JAVA PARAMETER
STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'java.lang.Math.max' ;

So therefore I think that the parameterNames array contains empty strings, not null values,
for unnamed parameters.

I'll add a comment to this effect in the RoutineAliasInfo class.

> Parameter names required in CREATE FUNCTION
> -------------------------------------------
>
>                 Key: DERBY-183
>                 URL: http://issues.apache.org/jira/browse/DERBY-183
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.0.2.0
>            Reporter: Jack Klebanoff
>         Assigned To: James F. Adams
>            Priority: Minor
>         Attachments: Derby183.patch.txt, Derby183.patch2.txt, Derby183.patch3.txt
>
>
> A statement like
>   create function s2.f2( char(8), integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> fails with the message
>   ERROR 42X01: Syntax error: Encountered "char" at line 1, column 24
> However
>   create function s2.f2( p1 char(8), p2 integer) returns int
>   language java parameter style java  external name 'myclass.mymethod'
> is accepted.
> The Derby documentation (at http://incubator.apache.org/derby/manuals/reference/sqlj27.html#CREATE+PROCEDURE+Statement),
the SQL2003 standard, and DB2 all agree that the parameter name is optional.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message