On Sun 04 Aug 2002 22:30, Tim Bunce <[EMAIL PROTECTED]> wrote: > On Sun, Aug 04, 2002 at 04:22:11PM +0200, 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. > > Thanks for pointing that out, I might have missed it ;-) > > > 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. > > Nice. > > > 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. > > Straw poll: which drivers are _capable_ of supporting this? > In other words, whicg drivers get enough info from the server to... > a: know they're fetching a date/time/timestamp field, and
DBD::Unify > b: if the server can only send the field as a string (not a binary struct etc) > and the server supports ways to configure the format of the string, > can the driver get enough info about the current format to parse > and deconstruct it? Probably, but how should we be dealing with Time Zones? If I fetch a Date/Time from the DB, I get a single number, and I would have to convert that to a struct. -- H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/) using perl-5.6.1, 5.8.0 & 632 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.024 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/