Joined: 30 Jul 2006
|Posted: Wed Sep 06, 2006 1:32 am Post subject: Informix SQL locking modes brief summary
Usually when an exclusive lock is placed on a data item, a different process trying to place an exclusive lock on the same data will fail. This also happens when a shared lock is placed on a data item and another process tries to place an exclusive lock on the same data item. Rather than fail, the second process can wait for a specified amount of time or until the lock is released by the first process.
To allow a process to wait for a specified amount of time, the process should declare
SET LOCK MODE TO WAIT time_amount_in_seconds
To set the wait to 10 seconds, use
SET LOCK MODE TO WAIT 10
For an entire minute, use
SET LOCK MODE TO WAIT 60
To let the process wait until the locking process releases its lock, use
SET LOCK MODE TO WAIT
To return to the default, use
SET LOCK MODE TO NOT WAIT
The lock mode continues until the process completes or it issues a different SET LOCK MODE command.