Subject Re: [IBO] How to clean up resources at closing program ?
Author Helen Borrie
At 04:08 PM 14/08/2003 +0200, you wrote:
>Hi all,
>
>In the FAQ is mentioned the following, in the context of TIBOQuery
>"If you close a connection and you have not closed and unprepared
>datasets, it will be done for you automatically."
>
>My questions:
>
>Does this also apply for TIB_Cursor and TIB_Query

Yes

> and TIB_DSQL ?

If it is prepared, it will be unprepared as part of the connection shutdown
cleanup. TIB_DSQL isn't a dataset component.

>And, under what conditions does this happen automatically ?

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.
Of course, if your users just crash out of the application, none of these
magic things happen at all. Eventually, the server will tidy up on its
side, though.

>Does this also happen automatically if TIB_Connection and the dataset
>component are not placed on the same TDatamodule ?

Yes. Datamodules and forms are just containers for objects.

Helen