Local Values

Previous Next

See Also

When a record is locked, for example when the user changes a column value, a SELECT_FOR_UPDATE statement is sent to the database. This single operation serves two purposes:

· All column values are queried.

 

· The record is locked.

Once a record is locked in the database on behalf of the current user, if column values of this record are needed later in the transaction, these values are not queried in the database but the client substitutes the values locally available.

This is particularly important for single-record constraints, for example: "The cancel date of a reservation must be later than the booking date". If a reservation is cancelled by entering the cancel_date field, first the record is locked, and then the locally available booking date can be substituted.

It is also applicable to some multi-record constraints, for example if a price must be compared with a price in some parent table. If the parent record is already locked because of foreign key manipulation, then the price in the parent table is read from client if available, and not re-queried in the database.