Subject | Re: [IBO] IB_Transaction.Close |
---|---|
Author | Helen Borrie |
Post date | 2005-10-09T13:46:04Z |
At 11:04 PM 9/10/2005 +1000, you wrote:
each for Active and if Active then Close
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.
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...
Helen
>What's the neatest way to "close" a transaction if you want all the queriesIterate through its Datasets[] array (from 0 to DatasetCount - 1), test
>using the transaction to also close and you're too lazy to close them
>individually?
>I call IB_Transaction.Commit, and then what?
each for Active and if Active then Close
>Help says you only call close when you want to destroy the object (I assumeYes, the transaction, for your needs. Connections also have a Datasets[]
>transaction)
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...
Helen