Subject | Re: milliseconds are not stored in the timestamp (KInterbasDB + Firebird) |
---|---|
Author | Petr Jakes |
Post date | 2006-05-03T15:03:26Z |
KInterbaseDB developer David Rushby was replying to me via E-mail:
=============================
The official API documentation does not mention that TIMESTAMP and
TIME fields store anything more granular than one second, and the
Firebird C API functions for converting those types do not handle the
sub-second component. Nevertheless, it is present.
I'm very glad to learn I was wrong. If the presence of the sub-second
component had been documented, it would have been supported by
KInterbasDB from the beginning.
I've already begun to write code that exposes the sub-second component
to the Python level.
============================
So according to David's information it looks milliseconds will be
suported in the next version. Thanks David.
Petr Jakes
=============================
The official API documentation does not mention that TIMESTAMP and
TIME fields store anything more granular than one second, and the
Firebird C API functions for converting those types do not handle the
sub-second component. Nevertheless, it is present.
I'm very glad to learn I was wrong. If the presence of the sub-second
component had been documented, it would have been supported by
KInterbasDB from the beginning.
I've already begun to write code that exposes the sub-second component
to the Python level.
============================
So according to David's information it looks milliseconds will be
suported in the next version. Thanks David.
Petr Jakes
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 06:29 AM 3/05/2006, you wrote:
> >I am trying to insert "timestamp" to the Firebird database using
> >standard library datetime module example given in the "KInterbasDB
> >Usage Guide" http://tinyurl.com/mplo4 , section "Example Programs
> >DATE/TIME/TIMESTAMP"
> >
> >Even timestamp has the correct format before inserting to the database
> >(2006-26-2 17:25:34.940279 for example), milliseconds are not stored
>
> Firebird stores subseconds to ten-thousandths of a second. If you
> try to store >4 places of decimal, as here, you should get an
> overflow exception. Possibly Python is silently handling such an
> exception and passing something different to what you expect.
>
> >and the database returns (2006,26,2,17,25,34).
>
> The database doesn't return a structure like this. Probably you have
> some Python function that is performing an EXTRACT query with
> insufficient granularity to return subseconds, e.g. it is casting the
> SECOND element as an integer. If EXTRACT (SECOND FROM
> MyTimestampColumn) is allowed to return a decimal(9,4) you will get
> the subseconds.
>
> >I have made some Googling the whole afternoon to find if it is
> >possible to configure Firebird or KInterbasDB, but no success.
> >
> >My environment: Fedora Core4, Firebird CS 1.5 (Dialect 3), Python
2.4.1,
> >KInterbasDB 3.2b1
>
> As this seems to be a Python thing, try subscribing to the
> firebird-python list and inquiring there about it.
>
> ./heLen
>