[Dbix-class] Getting access to the DB handle

Jess Robinson castaway at desert-island.demon.co.uk
Thu May 18 11:44:10 CEST 2006



On Thu, 18 May 2006, Dan Horne wrote:

> Hi all
>
>> From the DBIx::Class::InflateColumn doco:
>
> "Replace DateTime::Format::Pg [in the sample code] with the appropriate
> module for your database, or consider DateTime::Format::DBI"
>
> How would one use DateTime::Format::DBI in the inflate/deflate
> specification? I assume that I'd some how need to get the database handle in
> my table class definition, but I'm not sure how to do this...
>
> TIA
>
> Dan
>

Hi Dan,

Ahh.. minor documentation bug there.. Digging through the InflateColumn 
code, it appears that your inflate/deflate coderefs are called with 
($value, $self), thus you can do 
$self->result_source->schema->storage->dbh on it.. (I hope I have that 
right!)

I'll go fix the docs..

Jess




More information about the Dbix-class mailing list