On 8/9/06, Matt S Trout <[EMAIL PROTECTED]> 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


_______________________________________________
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/[email protected]/

Reply via email to