[Dbix-class] db handle disconnect?

Tim Keefer tkeefer at gmail.com
Wed Aug 9 21:10:53 CEST 2006


On 8/9/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>
> Tim Keefer wrote:
> > unfortunately I didn't make note of the versions before I upgraded.
> >
> > We're trying to accomplish two things,
> > 1) pull database connection info out of our conf so the models can be
> > shared between the web apps, scripts, etc.
> > 2) avoid extraneous connects to the database.
> >
> > Here's the exact code reference:
>
> Do
>
> sub db_Main {
>    return Class->get_schema->storage->dbh;
> }
>
> instead. DBIC's $dbh handling is much, much better than what you just
> showed.
> Then just have the "Class" class make the connection from the config and
> stash
> it somewhere its get_schema method can get to.
>
> Nice to see Gantry users finally getting the message though; it's release
> as a
> new framework using CDBI::Sweet (which I wrote the join code for before
> giving
> up on CDBI and starting DBIx::Class) made me sad somewhat. Also, if there
> are
> any Gantry devs out there who'd been interested in collaboration with the
> Catalyst project we certainly would be; it seems to be a very similar
> framework bar the Sweet/codegen stuff and I imagine there's a lot of
> code-sharing that could be done.



It appears that DBIC is even easier than I thought. Earlier, I found this in
the docs that made me think caching wasn't being done DBIx::Class at the
level we needed.

"Note that DBIx::Class::Schema does not cache connections for you. If
 you use multiple connections, you need to do this manually."

Yes, Gantry and Bigtop originally, and still supports Class::DBI models, but
we have recently realized that it doesn't play well with the other non
Class::DBI applications running in our mod_perl environment . We're now in
the process of adding support for DBIx::Class models which is working fine
running along side everything else.

Thanks for your help,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060809/2b733561/attachment.htm 


More information about the Dbix-class mailing list