On Mon, Dec 06, 2004 at 09:46:06AM +0100, Steffen Goeldner wrote:
> DBI::DBD informs us that
> 
>   The DBI Driver.xst code will call dbd_st_finish for you, if the
>   sth has the ACTIVE flag set, before calling dbd_st_destroy.
> 
> However, a pure perl DBD doesn't operate in such a luxurious
> environment, e.g.
> 
>   use DBI();
>   $sql = 'select * from .';
>   $dbh = DBI->connect('dbi:ExampleP:');
>   $sth = $dbh->prepare($sql); $sth->execute;
>   $sth = $dbh->prepare($sql); $sth->execute;
> 
> shows
> 
>   DBI handle 0x17faf40 cleared whilst still active at active_kids.pl line 5.
>       dbih_clearcom (sth 0x17faf40, com 0x1750b60, imp DBD::ExampleP::st):
>          FLAGS 0x80115: COMSET Active Warn PrintError
>          PARENT DBI::db=HASH(0x17fb620)
>          KIDS 0 (0 Active)
>          IMP_DATA ARRAY(0x17fb048)
>          NUM_OF_FIELDS 14
>          NUM_OF_PARAMS 0
>   panic: DBI active kids (2) > kids (1) at DBD/ExampleP.pm line 403.
> 
> How about adding a note similar to the one in DBI's execute() doc:
> 
>   If DESTROY() is called on a statement handle that's still active
>   ($sth->{Active} is true) then it should effectively call finish().

My natural inclination is to go the other way: Destroying a
still-Active statement handle ought to trigger a warning
(except during global destruction).

On the other hand, that horse bolted out the stable door long ago
and consistency with the compiled driver would be good.

I'll add the note and fix the supplied drivers.
I'll also avoid the "panic:" warning in this kind of situation.

Thanks.

Tim.

Reply via email to