Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

call of the dbd disconnect method via catalyst model

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


christian4catalyst at lists

Nov 22, 2009, 5:54 PM

Post #1 of 2 (575 views)
Permalink
call of the dbd disconnect method via catalyst model

Hi,

i wrote for my company an own DBD to control special things via SQL. Some
information would read only by open the connection. At this time i mean that
was a good decision. Now, with the Catalyst based web-frontend, i have a
problem.

Until i fix the reading of the meta-infos, i need as short workaround the
ability to close the dbd-connection which was hold through the model
component. I have look the docu, search in the source-code and introspect the
running system with the perl debugger, but i have nothing found what was
similar to a dbd-handle.

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 }

Thanks,
Christian

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Nov 23, 2009, 2:12 AM

Post #2 of 2 (513 views)
Permalink
Re: call of the dbd disconnect method via catalyst model [In reply to]

christian4catalyst [at] lists wrote:
> 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 }

Erm, this is a DBIx::Class question isn't it? (At a guess - you haven't
told us in any way what code you're using to provide your DB model, so
I'm just wildly speculating here).

You want to do something like $c->model('DB')->schema to get the
DBIx::Class::Schema, then call ->disconnect on that, or possibly
->schema->dbh->disconnect.

Cheers
t0m

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.