On Wed, Feb 13, 2002 at 10:58:34AM -0800, Jonathan Leffler wrote:
> On Wed, 13 Feb 2002, H.Merijn Brand wrote:
> >On Wed 13 Feb 2002 02:02, Jonathan Leffler <[EMAIL PROTECTED]> wrote:
> >> +=over 4
> >> +
> >> +*FIX ME* If there are statements 'active' when the $dbh is destroyed,
> >> +does DBI arrange to destroy those statement handles, or does the driver need to
> >> +do the work itself?
> >> +
> >> +=back
> >
> >Depends on the database. In DBD-Unify I *have to* do it myself, but some
> >guidelines would be much appreciated for future DBD's
> 
> At the moment, the DBD::Informix driver explicitly keeps track of
> all the database handles it has, and for each database handle,
> keeps a track of all the associated statement handles.  When a
> database handle is destroyed, I have code that tracks through all
> the associated statement handles and releases them.  *BUT* I've
> never spotted any activity while doing this.  So, I think that
> DBI is also keeping track of statement handles and calling the
> statement handle release code before calling the database handle
> release code, so my driver is doing unnecessary work.  I'd like
> to get rid of the code that tracks statement handles (in
> particular) and database handles.  But I'd like a clear statement
> from those who can understand the DBI code that this is
> unnecessary.

That a part of the DBI I only think I understand on alternate Thursdays :)

But I can tell you that when a database handle is destroyed the DBI
cannot to anything with the corresponding statement handles because
it doesn't have a copy of those handles (as that would create a
reference loop.  (One day the DBI may use weak refs for that.)

But... the statement handles hold a reference to their parent
database handle (possibly the inner handle, I forget) and so a
database handle won't normaly be DESTROY'd till all its children are.

> All this needs to be written out clearly (and with luck will be
> by the time I've finished), but it needs accurate input - GIGO
> applies.

I'm suffering with a bit of a head cold right now so you're likely
to get garbage out whatever the input :)

I'll let you consolidate any other inputs and repost a fresh diff
and I'll aim to reply to that within a few days.

Many thanks for this work Jonathan!

Tim.

Reply via email to