Subject Re: [Firebird-Java] Re: Timestamp fractional seconds
Author Helen Borrie
At 03:36 PM 02-10-02 +0000, you wrote:
>Hi,
>
> > Inserting a timestamp into Firebird:
> >
> > '2002-10-02 13:41:12.171'
> >
> > yields the following results on a select ...
> > iSQL: '2002-10-02 13:41:12.171'
> > IBConsole's iSQL: '2002-10-02 13:41:12'
> > Firebird-Java: '2002-10-02 13:41:12'
> >
> > So I assume, that firebird has the exact value but the java driver
> > (and IBConsole too) delivers it truncated?
> >
> > (same question in the following messages:
> > http://groups.yahoo.com/group/Firebird-Java/message/1754
> > http://groups.yahoo.com/group/Firebird-Java/message/1520
> > http://groups.yahoo.com/group/Firebird-Java/message/926
> > )
> >
> > Just wanted to ask if anybody has a workaround before I dig into
> > the sources.
>
>This is not driver issue, but core engine. If you have this table:
>
>create table test_time(
> timestamp_col timestamp
>)
>
>and you execute next statement in isql
>
>insert into test_time values('now')
>
>you will see that milliseconds are not there.
>
>The only workaround that comes to my mind is to use NUMERIC(18,0)
>field and store millis since 1.1.1970 (normal Java time
>representation).
>
>Best regards,
>Roman Rokytskyy

Actually, a better "workaround" might be to use the GetExactTimestamp UDF
on the server side. This is to be found in the
FBUDF.dll. Downside: FBUDF is currently available only for Windows
servers; and it works only with CURRENT_TIMESTAMP (or CAST('now' as
TIMESTAMP). It would be worth your while to download the source for it, if
you are considering a platform-independent Java-ish solution...

Helen