Subject | Re: Java Routines (was Re: [Firebird-Architect] Re: External Engines (and Plugins)) |
---|---|
Author | Roman Rokytskyy |
Post date | 2008-06-25T15:34:25Z |
>> a) each public static method can be called;Ok.
>> b) input parameters are specified as usual having the desired type (and
>> there is type mapping defined);
>>
> I'm doing this stuff, see below.
>> c) output parameters are specified as arrays of the desired type of sizeSorry, it must be supported as well.
>> 1; the routine itself assigns then the values to that very element of an
>> array and it is then returned into SQL layer.
>>
> Our output parameters (of stored procedures) are different from others
> DBMS. So I think we may use something (ResultSet, for example) different.
Like it or not, the SQL/J is supported by Oracle, IBM and Sybase at
least, so there is no other options. The ResultSet is somewhat different
and as extension should be supported too.
> In Oracle, you (always, AFAIK) need to specify the parameter types andCorrect.
> return type. You can specify types as "int" or "java.lang.Integer".
>
> In the implementation I'm doing, if types are not passed, it
> automatically maps INTEGER to java.lang.Integer.
> IMO, we should neverIt will happen automatically when you use "int" not "java.lang.Integer"
> transform NULL to 0.
in method declaration and pass null into Java reflection call. So NULL
should always be passed as null and if developers on the other end are
clever enough, they will use java.lang.Integer to be notified about NULLs.
>> Second, the SQL/J tells how to do the database calls from within theWe can handle both - Jaybird's design allows it (at least it should).
>> Java code. It postulates that using the JDBC URL
>> "jdbc:default:connection"
> In Oracle it's "jdbc:default:connection:" (not the ":" at end).
>> one can obtain a database connection withinGood :)
>> the same context in which the Java routine was called. Then developer
>> can use normal JDBC code to perform queries, etc.
>>
> Already working in my implementation. ;-)
>> However, since these two cases looks quite important, we (Evgeny, VladYup, this was also implemented in our code, probably there is something
>> and myself) have "extended" the specification to support them. In case
>> of result set it looked obvious to use same JDBC interface as usual,
>> however it does not really matter.
>>
> I think we can support return of java.sql.ResultSet, but we should
> construct (derived from ResultSet) another class to make easy creation
> of selectable procedures that produce rows, like ExternalResultSet from
> FirebirdExternalApi.h. It's very difficult and non-sense to implement
> ResultSet methods to return values.
similar in RedSoft's code as well.
Roman