[Dbix-class] ANNOUNCE: Datetime::Format::Oracle

Nathan Gray kolibrie at graystudios.org
Mon Nov 6 14:23:35 GMT 2006


Oracle's date datatype is supported via parse_date, format_date,
parse_datetime, format_datetime.

I plan to add 'timestamp' and 'timestamp with time zone' methods after
I install 9i client libraries on my computer.

I request that a datetime_parser_type method be added to
DBIx::Class::Storage::DBI::Oracle:

  sub datetime_parser_type { return "DateTime::Format::Oracle"; }

I am concerned by the treatment of 'datetime' and 'timestamp' in
DBIx::Class::InflateColumn::DateTime.

In Oracle, the 'date' datatype may contain time information, so is
really a datetime datatype.  The 'timestamp' datatype in Oracle adds
fractional seconds, and the 'timestamp with time zone' datatype adds
time zone information.

My concern is that DBIx::Class::InflateColumn::DateTime uses the
'parse_datetime' and 'format_datetime' methods for 'timestamp'
datatypes.  In Oracle, the format of each of the three time datatypes
are controlled by separate formatting settings, so the formats may
be different from each other.

I am also concerned that 'timestamp with time zone' datatypes are
ignored by DBIx::Class::InflateColumn::DateTime.

I would like to see 'timestamp with time zone' run the
parse_timestamp_with_time_zone and format_timestamp_with_time_zone
methods, if they are available, and fall back to timestamp methods
otherwise.

So 'timestamp with time zone' would attempt, in this order:

  parse_timestamp_with_time_zone
  parse_timestamp
  parse_datetime

and

  format_timestamp_with_time_zone
  format_timestamp
  format_datetime

A plain 'timestamp' datatype would attempt, in this order:

  parse_timestamp
  parse_datetime

and

  format_timestamp
  format_datetime

Oracle also has a 'timestamp with local time zone' datatype, which
really is just a timestamp (and will not return nor accept time zone
information).  It is special in that it uses the time zone of the
session to calculate the date and time to return.  For this datatype,
it seems the order of methods to try would be:

  parse_timestamp_with_local_time_zone
  parse_timestamp
  parse_datetime

If it is agreed that there should be a
'parse_timestamp_with_time_zone' in that list, I can support that.

In any case, Enjoy!

-kolibrie




More information about the Dbix-class mailing list