[Dbix-class] db handle disconnect?
Matt S Trout
dbix-class at trout.me.uk
Wed Aug 9 19:05:45 CEST 2006
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.
More information about the Dbix-class
mailing list