Subject Re: [IBO] Sorry, but I got lost again (about transaction)
Author Helen Borrie
At 08:57 AM 5/12/2003 +0800, you wrote:
>Sorry for my lack of knowledge.
>
>My question is what if I want to use the internal transaction that you
>are mentioning of each dataset set. How and where will I be able to
>change some of it's properties like the Isolation to Read Committed?
>Like in then TIB_transaction component we can set it's Isolation property?

The dataset uses the connection's <DefaultTransaction>. If the connection
is using an explicit transaction instead of the DefaultTransaction, then
the dataset uses that. To access it from the the dataset, refer to the
dataset's IB_Transaction property.

e.g. MyDataset.IB_Transaction.Isolation := ReadCommitted;

You will get an error if you try to do that whilst the transaction is in a
Started state. And don't forget that anything you do at that level will
affect *all* datasets in the transaction, not just that one.

The *right* way with IBO (IMO) is not to use the <DefaultTransaction> at
all. Always have at least one explicit transaction. If you need more, add
more. And, in the datasets, always explicitly set the IB_Transaction
property to be the one you want.

I typically have a minimum of two transactions attached to any connection
object. One is used for scrolling datasets and their embedded DML. The
other is used for one-off loading of ib_cursor sets into non-data-aware
components or controls (stringlists, listboxes and the like). I implement
methods to do that, which are called at the datamodule's FormCreate and,
during a client session, any time the non-data-aware objects need to be
refreshed.

If I do an interface that uses read-only datasets for things like selector
boxes, then I have a third transaction, read-only, ReadCommitted, for those.

Helen