ODBC has a built-in standard for this - I forget exactly what it is, but 
it's something like {d YYYY-MM-DD}, {t HH:MM:SS} and {ts YYYY-MM-DD 
HH:MM:SS}

(for input, that is - I think output is still database specific, but I 
could be wrong).

Alternatively, you could specify something like a Time::Piece object as 
input and output.

On Sunday, August 4, 2002, at 03:22 PM, Daniel Ritz wrote:

> hi
>
> [please CC as i'm not on the list]
>
> DBI has a real problem: input/output of date/time/timestamp values. 
> each driver handles it different.
> most of the drivers returns string, but all in a different format. this 
> is where DBI should set a standard.
>
> in DBD-InterBase we now have a very flexible interface. for input a 
> string is directly passed to the interbase
> parser. for output we use strftime() to format the date/time/timestamp 
> string. when preparing a query one can
> specify the output format with the attributes ib_dateformat, 
> ib_timeformat, ib_timestampformat. and if one
> specifies 'TM' for the format string then DBD returns a refrerence to 
> an array with the same fields as perl's
> localtime() function does (it is all the struct tm members). for input 
> it's the same. if a reference to an array
> is detected that has enough element it is used to fill a struct tm.
>
> now i'd like to see something similar to that in other DBDs. DBI should 
> set a standard here to allow one
> to easly change the underlying database w/o changing to much in 
> scripts. DBI means Database independent
> interface but it is not for date/time values.
>
> may be there should be an attribute to dbh or an attribute for prepare 
> or whatever. arrayref for all DBD
> would be very nice. it doesn't need to be like localtime(), something 
> like
>     (year, month, day, hour, minute, second, fraction)
> would also do.
>
>
> regards
> -daniel
>

Reply via email to