[Dbix-class] call of the dbd disconnect method via catalyst model

Joel Bernstein joel at fysh.org
Fri Nov 27 17:09:35 GMT 2009


2009/11/27 christian <christian4dbix at lists.muthpartners.de>:
> Can me someone say, where i can, who i can close the dbd-connection in
> line 09, so that line 10 reopen the connection.
>
> 01 sub  foo
> 02 {
> 03   my         ( $self, $c )   = @_;
> 04   my         $model          = $c->model('DB::TABLE') ;
> 05   my         $row ;
> 06   my         $res ;
> 07
> 08   $row       = { ... } ;
> 09   ## $model->        method to call for dbd->disconnect()
> 10   $res       = [$model->search($row)] ;
> 11
> 12  ...
> 13 }

I think you want:
$schema->storage->disconnect;

in the context of a Catalyst app, you'd use the C::Model::DBIC::Schema
(without constructing a resultset) like this:
$c->model("My::DBIC::Schema")->storage->disconnect;

or if you must start from a RS like above:
$c->model("My::DBIC::ResultSet")->result_source->storage->disconnect;

/joel



More information about the DBIx-Class mailing list