On Thu, 23 Jun 2005, Tim Bunce wrote:

> For a driver handle the children are the database handles.
> For a database handle the children are the statement handles.
> $h->{ChildHandles} gives you the children of that handle.
> 
> Does that make sense?

Yes it does.  Sorry, I should have removed that question - by the time
I finished my reply I got it.

> Not infinite, but a $dbh->do("INSERT ...") while (...) will create
> and destroy a statement handle on each iteration in most drivers.

That's a good point.

> We still need to address the purging of destroyed handles.
> This should work well enough:
> 
>     if ($HAS_WEAKEN && $parent) { # drivers don't have parents
>       my $ch = $parent->{ChildHandles} ||= [];
>       # purge destroyed handles occasionally
>       @$ch = grep { $_ } @$ch if @$ch % 120 == 0 && @$ch;
>         push @$ch, $h;
>         Scalar::Util::weaken($ch->[-1]); 
>     }

That looks do-able.  I'll try to work up a patch in the next couple
days.  I'll include the DBI->installed_drivers() method as well, if
that's ok.

-sam

Reply via email to