Subject Re: [IBO] Transactions query
Author Geoff Worboys
> What it happens for a master - detail form where you have
> changed or inserted the header and are working with the
> lines? What is the isolation level that warranties the
> header and the lines are protected until the user commits
> the transaction?

Assuming the header and detail are on the same transaction (which they
will have to be if you dont want to run into other problems) then ANY
transaction level will prevent another user from changing records that
you have already changed (and vise versa). This is the entire point
of using transactions and interbase does not provide any way of not
using transactions.

The different transaction levels are used to impact on the visibility
of the changes that have been made (tiCommitted versus tiConcurrency -
the changes are protected whether they are visible or not) or whether
simply reading data will prevent others from changing it
(tiConsistency). See the IBO online help for more details.

> if we need to specifically lock the header for getting what
> we want. In fact, that is what we did when we used the BDE.

Because the BDE used automatically committed transactions. That is,
it forced the highly sophisticated client-server DBMS to act like a
simple desktop database, with all the inherent problems.

It is very rare that you will need to use pessimistic locking. One
instance where you **may** decide to do this is if you are
adding/changing detail entries associated with an existing master
record and need to be sure no-one else is also altering details
associated with that same master record.

Needing to do this is sometimes an indicator that there is something
wrong with your database design, but at other times we developers
choose a theoretically poor design for other reasons.

Side Note: The TransactionPausing tutorial shows two grids
side-by-side, each with their own transaction, and allows you to alter
the transaction isolation of each grid so that you can see the impact
of each isolation level. (At one stage the tutorial was released with
much of the code commented out for some reason, if it is still like
that just remove the comments.)


Geoff Worboys
Telesis Computing