[Dbix-class] Inflating and deflating Oracle dates

Dan Horne dan.horne at redbone.co.nz
Tue Jun 6 20:16:05 CEST 2006


> From: dbix-class-bounces at lists.rawmode.org [mailto:dbix-class-
> bounces at lists.rawmode.org] On Behalf Of Hartmaier Alexander
> Sent: Tuesday, 6 June 2006 8:59 p.m.
> 
> I created on_connect_do for exactly this purpose.
> I use Oracle and needed to set the date format because the one in the
> oracle init file isn't used with perl DBI.
> I assumed that DBD::Oracle sets it to some DBI standard datetime format...
> So I set the date format you seem to use too (from you example) and use
> this one everywhere.
> 
> -Alex

Hi Alex

Thanks for your response. I write my app against MySQL, but I periodically
test it against Oracle to ensure that no db-specific code has crept in.
What's the best way to deal with on_connect_do without breaking a db-generic
solution?

I've been chipping away at this problem as I get time, and this is what I've
done so far. Since posting my question I've created a module called
DateTime::Format::Oracle which implements parse_datetime, parse_date,
format_datetime and format_date based on the NLS_DATE_FORMAT environment
variable. Once I've written the tests, I'll ask the DateTime list for
feedback.

If this all works, I'll hopefully be able to reference the parser to
DBIx::Class::Storage::DBI::Oracle so that
DBIx::Class::InflateColumn::DateTime will work with Oracle too.

Dan




More information about the Dbix-class mailing list