Thanks, Tim.
One more question to the group:
If I "undef $dbh" when it is active and it has active (or inactive) child handles, what happens exactly? Is an actual $dbh->disconnect() made, and are the $sth's finished at all? Is it DBD dependent?

Thanks in advance,
Henri.

On Aug 28, 2006, at 11:15 PM, Tim Bunce wrote:

On Thu, Aug 24, 2006 at 09:47:56AM +0200, Henri Asseily wrote:
Is the below the correct usage for finishing still active child
handles of a dbh?


foreach my $childh (@{$dbh->{ChildHandles}}) {
    $childh->finish() if ($childh->{Type} eq 'st');
}

The children of a dbh will always be sth, but the test is harmless.

I'm getting an error when running the above code:

dbih_setup_fbav: invalid number of fields: -1, NUM_OF_FIELDS attribute probably not set right

Looks like a bug (in the driver, I'd guess, but you don't say which)
because calling finish should never need to call dbih_setup_fbav.

But checking for Active will probably avoid the problem:

 $_->finish for grep { $_->{Active} } @{$dbh->{ChildHandles}};

Tim.

Reply via email to