[Dbix-class] Re: DBH handle upon connect

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Tue Feb 12 20:12:12 GMT 2008


Steve Kirkup <skirkup at jupiterimages.com> writes:

> When I establish my connection to the database I want to immediately run
> some SQL to initialize the databases session environment (specifically
> the NLS_DATE_FORMAT  for Oracle).

This is exactly what the "on_connet_do" attribute to ->connect is for:

<http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Storage/DBI.pm#connect_info>

> My question is how do I get ahold of that database handle?  The
> DBIx::Class::Schema->connect() makes no mention of one being available.

You don't want to do that manually, since 1) DBIC only connects when it
needs too and 2) it won't get rerun if DBIC has to reconnect for some
reason.

-- 
ilmari
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen




More information about the DBIx-Class mailing list