[Dbix-class] Inflating and deflating Oracle dates

Brandon Black blblack at gmail.com
Wed Jun 7 18:59:28 CEST 2006

On 6/6/06, Dan Horne <dan.horne at redbone.co.nz> wrote:
> > 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?

In DBIx::Class dev release 0.06999_01, you can insert on_connect_do as
a hash entry in the final element of your connection information,
which should solve this part of the issue.  For instance, when using
Oracle, set up your oracle connect_info arguments like:

...->connection( 'dbi:Oracle:dbname=testdb', 'orauser', 'orapass', {
AutoCommit => 0 }, { on_connect_do => .... });

And then simply don't specify it when using MySQL connect info.

[ Incidentally, the 0.06999_01 documentation for this feature is
somewhat botched up, but there are corrected docs in svn
branches/DBIx-Class-current ]

If your usage happens to be via Catalyst,
Catalyst::Model::DBIC::Schema already explicitly supports this syntax
for the existing 0.06xxx DBIx::Class release series in the Models'

-- Brandon

More information about the Dbix-class mailing list