Subject Re: [IBO] How to clean up resources at closing program ?
Author Helen Borrie
At 02:46 PM 15/08/2003 +0200, you wrote:
>Thanks for your answer, Helen
>
>One more question about this:
>
> > When the connection shutdown sequence calls the Close() method of each
> > transaction, each transaction's linked statement objects get cleaned
> > up. In the case of some datasets, there might be a delay if there are
> > unfetched rows, because the dataset object will deal with them first.
> > If you don't call Connection.Disconnect explicitly, it will be done by the
> > connection's owner.
>
>Does the above imply that I should only use
>
>Transaction.Close
>
>not followed by
>
>Connection.Disconnect
>
>because the Close method has already taken care for that ?

No, in a clean application, the opposite. Connection.Disconnect will
ensure that the transactions associated with it will be made to do their
cleanup. Connection.Disconnect will ultimately get called by the owner of
the connection, anyway.

Really, the main cleanup thing you have to be concerned about is a matter
of good Delphi practice, rather than anything you specifically have to do
"because it's IBO". Don't have destructors calling destructors for objects
that own other objects which have complex dependencies that might mess up
references in unforeseen ways. When people do that sort of thing in an
untidy fashion, we'll typically see a panic list message with the Subject
"Application AVs on exit". Those mistakes can be really hard to troubleshoot.

This is a propos one part of your question, which was about having query
objects located on a different form to the connection object. This is just
fine as long as you keep to the basic Delphi rules of ensuring that objects
are always able to destroy their own creations without interference.

Helen