[Dbix-class] Getting a database handle

Ivan Wills ivanw at benon.com
Wed Jan 3 21:53:08 GMT 2007


Brandon Black wrote:
> 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
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
> http://www.mail-archive.com/dbix-class@lists.rawmode.org/
Why is long-term storage bad? Is refreshing it every request short
enough? The DBIx::Class::Storage::DBI docs do not give any details on
why long-term storage is bad.

Ivan Wills



More information about the Dbix-class mailing list