|
|
|
|
|
- Modifying the type of lock for a record
- Effect of lock mode
- Lock failure
- Number of locks
- SQL Server Native Connector: Lock in write mode only
- Managing locks in OLE DB
- Persistence of lock
<Source>.LockRecNum (Function) In french: <Source>.BloqueNumEnr
 Not available with these kinds of connection
Locks a record and restricts the access to this record for all the other applications. Then, the record can be unlocked by <Source>.UnlockRecNum. Note: After executing function <Source>.LockRecNum, several cases may arise: - Registration already blocked by another application: blocking cannot be performed.
- The data file containing the record is blocked in its entirety: blocking cannot be performed.
An automatic management of lock errors and modification conflicts is performed by default (except in the code of stored procedures). This assisted management of errors can be customized or disabled at any time by <Source>.OnError. Caution: This <Source>.LockRecNum function must be used with caution: when blocked, the recording is not replayed.. Therefore, it may have been deleted or modified since the last access to this record. It is recommended to use <Source>.Read with a lock option.
Customer.LockRecNum(hRecNumCurrent, hLockReadWrite)
...
Customer.UnlockRecNum()
Syntax
<Result> = <Source>.LockRecNum([<Record to lock>] [, <Lock>])
<Result>: Boolean - True if the operation was performed,
- False if a problem occurs. HError is used to identify the error.
<Source>: Type corresponding to the specified source Name of the data file used. <Record to lock>: Optional integer Number of the record to lock. If this parameter is not specified, <Source>.LockRecNum will handle the current record. <Lock>: Optional integer constant Used to define the type of lock set on the record. | | hLockNo | No lock: the recording can be played back or modified by another application. | hLockReadWrite | Read/write block: data file record cannot be read or modified by another application. The other application will not be able to lock the record or the data file. | hLockWrite (default value) | Write block: data file record can be read by another application but cannot be modified by another application. The other application will not be able to lock the record or the data file. |
Remarks Modifying the type of lock for a record To modify the type of record lock, call <Source>.LockRecNum and specify the requested type of lock. There is no need to unlock the record beforehand. Effect of lock mode If the data file lock mode is set to hModeMono (see <Source>.Mode), <Source>.LockRecNum has no effect. Lock failure If the record is already locked, the lock request is retried HNbRetry times (50 by default). If the data file cannot be locked after H.NbRetry attempts, HErrorLock returns True. The H.Level variable indicates whether the record or the data file is locked. Number of locks The number of records that can be individually locked in a data file is unlimited.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|