develooper Front page | perl.datetime | Postings from July 2003

Re: DT::F::DBI docs

Thread Previous
From:
claus
Date:
July 16, 2003 16:43
Subject:
Re: DT::F::DBI docs
Message ID:
8q3sm1W3cDD@perl.3247.org
Eugene Van Der Pijll <pijll@gmx.net> schrieb/wrote:
> Joshua Hoblitt schreef:
>>> Well, there are only two modules: DT::F::MySQL and DT::F::Pg.
>> I'd really like to see a lot more database formatters.
> <snip 10 other databases>

> Do all of these have different datetime formats? If database X has the
> same formats as e.g. Pg, it doesn't need a separate format. Of course
> DT::F::DBI should know about these cases.

> Should there be a default format DT::F::SQL for DT::F::DBI? (I don't
> know if SQL defines a date format, so I don't know if this is possible.)

Yes, SQL-92 defines some data types and format(s):
  http://www.ibphoenix.com/a600.htm
  http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt

Unfortunatly, many SQL implementations behave slightly differnt; for the  
two modules we already have:

mySQL:
  . does not implement the time zone types.
  . handles timezones for non-timezone types differently from SQL92
    (SQL92: conversion to/from UTC and local timezone, mySQL: no
    conversion at all.)
  . does implement SQL's TIMESTAMP as DATETIME
  . implements a TIMESTAMP type that's incompatible with SQL.
  . has an extended TIME type
  . does not implement INTERVAL types
  . only supports years from the range 1000..9999 (SQL: -9999..9999)

PostgreSQL:
  . implements three non-SQL output formats: 'German', 'PostgreSQL', and
    'SQL' (whose name is a historical accident) that need to be handled
    by the parser.
  . uses 10000 BC..1 BC for the years -9999..0000 (In SQL92, there seems
    to be no valid syntax to specify the years -9999..-0001 although it
    explicitly defines the range to be -9999..9999)
  . has a strange behaviour wrt timezones and dates before 1901-12-14 or
    after 2038-01-18.
  . has a custom format for INTERVALs.

Because of all these special cases it is easier not to implement the
parsers/formatters by using a base class with a default format.

Claus
-- 
http://www.faerber.muc.de


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About