RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
ADODB.TADOLockType Enumeration

TADOLockType specifies the types of locks used.

Pascal
TADOLockType = (
  ltUnspecified,
  ltReadOnly,
  ltPessimistic,
  ltOptimistic,
  ltBatchOptimistic
);
C++
enum TADOLockType {
  ltUnspecified,
  ltReadOnly,
  ltPessimistic,
  ltOptimistic,
  ltBatchOptimistic
};

Use TADOLockType with execution methods to specify the types of record locks used during editing. Lock type values allow you to specify whether the locking scheme used for a recordset is optimistic or pessimistic. To use a specific locking scheme, the provider and database type must support that locking scheme. Use ltUnspecified to have the provider use the default locking scheme. Use the LockType ltBatchOptimistic to open a recordset in batch update mode. 

In addition to use as command execution method parameters, TADOLockType values are passed as var parameters to event handlers related to execution. This value indicates the lock type already in use when the execution was initiated. The LockType parameter of the TADOConnection. ::OnWillExecute event is an example of this. 

The constants that make up the TADOLockType type correspond directly to the LockTypeEnum values with similar names. These values are discussed in the Microsoft Data Access SDK help, in the topic for the LockType property of the ADO Recordset object. See the SDK for additional information on the ADO constants and their effects. 

TADOLockType consists of the five constants summarized in the following table:

Lock Type 
Meaning 
ltUnspecified  
A specific lock type has not been specified or determined.  
ltReadOnly  
Read-only; the current execution cannot modify data.  
ltPessimistic  
Pessimistic locks; locks instantiated on a record-by-record basis when edit mode is applied to a record.  
ltOptimistic  
Optimistic locks; locked are initiated on a record-by-record basis, but only when updates are applied and a record is being updated.  
ltBatchOptimistic  
Optimistic batch updates; used for batch update mode rather than immediate update mode.  

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!