[Dbix-class] Getting a database handle

Brandon Black blblack at gmail.com
Wed Jan 3 14:21:11 GMT 2007


On 1/2/07, Pedro Melo <melo at simplicidade.org> wrote:
> Hi,
>
> On Jan 3, 2007, at 2:22 AM, Ivan Wills wrote:
>
> > I am using DBIx::Class in a new Catalyst project which will include
> > some
> > legacy code that uses plain DBI. Is there a way to get the database
> > handle from my schema and pass it on to the legacy code? I could
> > not see
> > how to do this from the docs.
>
> $schema->storage->dbh
>
> See perldoc DBIx::Class::Storage::DBI
>

But don't store this anywhere long-term or you'll shoot yourself in
the foot.  Retrieve it freshly when you need it, use it immediately,
and let it fall out of scope.

-- Brandon



More information about the Dbix-class mailing list