"Michael A. Smith" <[EMAIL PROTECTED]> writes:

> On Fri, 26 Apr 2002 [EMAIL PROTECTED] wrote:
> > Of course, you can't use database specific functions in a cross database
>> way.  But you can support a subset of functions that are common across
>> the different databases even if they use different syntax, example would
>> be date part functions, like in mysql, you would use YEAR(), MONTH(),
>> etc, and in MS SQL Server you would use datepart("y", date).  That kind
>> of thing.  And in some cases, you could support it if possible, say your
>> decode function, if there was support in that database for it, then it
>> could use it, if not then it would just ignore it.
>
> Isn't that what {fn ...} in JDBC is supposed to be for?  i.e. in JDBC to 
> get the year of the current month, you could use: {fn YEAR(date)}.
>
> http://java.sun.com/products/jdk/1.2/docs/guide/jdbc/spec/jdbc-spec.frame11.html

Yes, but the standard JDBC escape sequences (which also cover things
like time stamps) can't cover every RDBMS-specific function known to
man.  An additional adapter layer is useful for implementing functions
like that in Java code when the db doesn't support them natively or
the JDBC hasn't been taught about them yet (fwiw, Torque does this).

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to