On 8/9/06, Tim Keefer <[EMAIL PROTECTED]> wrote:
unfortunately I didn't make note of the versions before I upgraded.

What exactly is broken?  What error messages/behavior happen that you expected to be different? 

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:

[.......]

Well, you could handle the configuration side of your issue easily without a coderef in connect_info, so I can only assume you're doing all of this because you're trying to share a single $dbh with non-DBIC code in the same running interpreter?  Have you considered just connecting a $schema object using your info the normal way, and "sharing" the $dbh via mechanisms like:

sub my_code_that_does_not_use_dbic_but_gets_dbh_from_a_dbic_schema {
    my ($self, $schema, @other_stuff) = @_;
    my $dbh = $schema->storage->dbh;
    $dbh->do(...);
    return;
}

This would allow DBIC to manage the $dbh for you and still give access to other code.  DBIC has hundreds of lines of code devoted specifically to managed $dbh's better than your subroutine can - you should let it do the work for you if possible.

The only known issue at the moment for 0.07000 sharing $dbh with other code is that when your connected schema object goes out of scope, its going to forcefully disconnect the active $dbh connection that other code might be using.  There's a fix for that in -current, I'll make sure it makes it into trunk for 0.07001 too.

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

Reply via email to