Re: [CDBI] Close CDBI DB connection?
[prev]
[thread]
[next]
[Date index for 2005/09/29]
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