Re: [CDBI] Close CDBI DB connection?

[prev] [thread] [next] [Date index for 2005/09/29]

From: yoorobot
Subject: Re: [CDBI] Close CDBI DB connection?
Date: 15:12 on 29 Sep 2005
thats just a standard idiom in DBI... which Ima::DBI and therefore  
Class::DBI inherit from.
db_Main provides access to the db handle.

see the DBI perldoc for more info.

On Sep 29, 2005, at 9:51 AM, Steven Mackenzie wrote:

>
>
>
>>> Is there a (nice or nasty) way to ask CDBI to disconnect when I'm
>>> finished using the database?
>>>
> yoorobot@xxxxx.xxx wrote:
>
>> Class->db_Main->disconnect ?
>>
>
> Yes, thanks, that did the job!
>
> I did search the CPAN doc for "disconnect", and even backing up the  
> doc
> hierarchy to Ima::DBI doesn't mention it -- is it a rebellious  
> thing to do?
>
> Stepping through the code I find myself in Ima::DBI and see this:
> sub _mk_db_closure {
>     my ($class, @connection) = @_;
>     my $dbh;
>     return sub {
>         unless ($dbh && $dbh->FETCH('Active') && $dbh->ping) {
>             $dbh = DBI->connect_cached(@connection);
>         }
>         return $dbh;
>     };
> }
>
> So I'm getting a random connection from a cache (I guess?), and  
> closing
> it. Should I be shutting the cache down instead?
>
> Anyway, thanks, for my current problem you've given me a fine  
> solution,
>
> Steven
>
>


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Close CDBI DB connection?
Steven Mackenzie 13:35 on 29 Sep 2005

Re: [CDBI] Close CDBI DB connection?
Steven Mackenzie 14:51 on 29 Sep 2005

Re: [CDBI] Close CDBI DB connection?
yoorobot 15:12 on 29 Sep 2005

Generated at 15:06 on 02 Oct 2005 by mariachi v0.52