On Wed, 22 Jun 2005, Tim Bunce wrote:
> I'd rather go with ChildHandles as per the outline in my previous email.
If you insist. I don't understand the use of "child" here. What is
the "parent"?
> Your patch uses a global $DBI::active_handles which will grow
> without bound.
It is bounded by the number of handles created by a program. Surely
that can't be infinite!
> The $dbh->{ActiveHandles} will return _all_ handles, not only those
> that are the child of the $dbh.
That's exactly what I need - a way to find all DBI handles. I'm
willing to scratch a few adjacent itches though, if it'll get me what
I need.
> Using weaken($parent->{ChildHandles}{$h} = $h) avoids the need
> for a global,
Do you really want a hash used instead of an array? It seems like the
most common operation will be to iterate through the list of handles,
which suggests an array to me.
> $dbh->{ChildHandles} will only return children of that $dbh, and
> $drh->{ChildHandles} can be used to find all the connections for a
> particular driver handle.
That makes sense. So then to find all handles I would iterate through
%installed_drh and call ChildHandles recursively on down?
> There should be no need for any DBI.xs code to support ChildHandles
> as it lives in the attribute cache as a simple hash ref. It should
> also 'just work' for DBI::PurePerl.
I'll give that a try. I'm not sure about the no-XS part though, since
it looks to me like DBI.xs has to know about all attributes. I might
be missing some magic though.
> I'd be grateful if you could rework the patch along those lines.
Will do.
-sam