Re: finishing sth using Childhandles



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.
.



Relevant Pages

  • Re: finishing sth using Childhandles
    ... active sth. ... dbh or sth, I can update the dbh to turn off syb_flush_finish, which is quite logical and should be done by the client ... at that time the dbh may well be in a bad state since it's right after a signal interrupt. ... Toute utilisation de ce ...
    (perl.dbi.users)
  • Re: swap_inner_handle
    ... I create a new dbh and swap its inner handle with dbh. ... Now is sth a child of dbh or new_dbh? ...
    (perl.dbi.users)
  • Re: swap_inner_handle
    ... I create a new dbh and swap its inner handle with dbh. ... Now is sth a child of dbh or new_dbh? ... Ok so now sth and new_sth are children of the same inner dbh, and no reparenting is being done when I swap them. ...
    (perl.dbi.users)
  • RE: Questions about connectivity
    ... > I have a related question, if I've stored some private_ data in the $dbh ... I wanted to use an ErrorHandler subroutine which reads the private_ data. ... But if the error occurs through an $sth I get a DBI::st rather than the ... to control the creation code of the $dbh not any subsequent $sth's). ...
    (perl.dbi.users)
  • Re: swap_inner_handle
    ... Say I have a dbh with an active sth. ... I create a new dbh and swap its inner handle with dbh. ...
    (perl.dbi.users)