Subject Re: [IBO] IB_Transaction.Close
Author Helen Borrie
At 11:04 PM 9/10/2005 +1000, you wrote:
>What's the neatest way to "close" a transaction if you want all the queries
>using the transaction to also close and you're too lazy to close them
>I call IB_Transaction.Commit, and then what?

Iterate through its Datasets[] array (from 0 to DatasetCount - 1), test
each for Active and if Active then Close

>Help says you only call close when you want to destroy the object (I assume

Yes, the transaction, for your needs. Connections also have a Datasets[]
array that you can use, e.g. when you have multiple transactions and you
want to find all the datasets, or you are only using the internal transaction.

Actually, the help doesn't say what you said it says. It says it's
*typically* used under those conditions - indeed, it's in the
ib_transaction's destructor.

>or it's connection.

Transaction.Close is like a "friendly" commit. It first calls Commit and,
if there is an exception, it silently intercepts it and rolls back
instead. Once that's settled, there are no open cursors. That's a
different situation from calling Close on a dataset, since closing a
dataset doesn't do anything on the server side (other than to complete
fetching any rows still waiting to be fetched); once the EOF is file is
encountered, it then clears the buffers.

I'm not even sure that Transaction.Close clears the dataset buffers, since
it might leave that to the datasets to do themselves, in their own
destructors. I haven't checked that in the sources, but you could...