[Dbix-class] db handle disconnect?
Jess Robinson
castaway at desert-island.demon.co.uk
Wed Aug 9 18:30:09 CEST 2006
On Wed, 9 Aug 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:
>
> sub db_Main {
> my $invocant = shift;
> my $class = ( ref $invocant ) ? ref $invocant : $invocant;
>
> my $dbh;
>
> my $helper = Gantry::Utils::DBConnHelper->get_subclass();
>
> $dbh = $helper->get_dbh();
>
> if ( not $dbh ) {
> my $conn_info = $helper->get_conn_info();
>
> my $db_options = $class->get_db_options();
>
> $db_options->{AutoCommit} = 0
> unless defined $db_options->{AutoCommit};
>
> $dbh = DBI->connect_cached(
> $conn_info->{ 'dbconn' },
> $conn_info->{ 'dbuser' },
> $conn_info->{ 'dbpass' },
> $db_options
> ) ;
> $helper->set_dbh( $dbh );
> }
>
> return $dbh;
>
> } # end db_Main
>
I don't see where DBIx::Class is involved there at all?
Jess
More information about the Dbix-class
mailing list