LockStrength enumeration: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<!-- LockingStrength enumeration --> | <!-- LockingStrength enumeration --> | ||
This enumeration is used to indicate the strength of a lock, and is often used in controlling locking for <var>[[Record_class|Record]]</var> and <var>[[Recordset_class|Recordset]]</var> objects. When an object referencing one or more records is instantiated, the referenced records are locked with a particular lock strength, either implicitly as with the <var>Find All Records</var> and <var>Find And Reserve</var> statements or explicitly as with the [[New (Record constructor)]] and [[New (Recordset constructor)]] methods. | This [[Enumerations|enumeration]] is used to indicate the strength of a lock, and is often used in controlling locking for <var>[[Record_class|Record]]</var> and <var>[[Recordset_class|Recordset]]</var> objects. When an object referencing one or more records is instantiated, the referenced records are locked with a particular lock strength, either implicitly as with the <var>Find All Records</var> and <var>Find And Reserve</var> statements or explicitly as with the [[New (Record constructor)]] and [[New (Recordset constructor)]] methods. | ||
These are the valid values of this | These are the valid values of this enumeration, which correspond to standard <var class="product">Model 204</var> record-locking levels: | ||
<table> | <table> | ||
<tr> | <tr> | ||
<th>None</th> | <th>None</th> | ||
<td>Object is not locked.<br/>No locks are held on the object, so there can be no conflict with others holding <var>Share</var> or <var>Exclusive</var> locks (readers and updaters may proceed). <var>Find Without Locks</var> statements acquire this type of record lock for Recordsets.</td> | <td>Object is not locked.<br/>No locks are held on the object, so there can be no conflict with others holding <var>Share</var> or <var>Exclusive</var> locks (readers and updaters may proceed). <var>Find Without Locks</var> statements acquire this type of record lock for <var>Recordsets</var>.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th>Share</th> | <th>Share</th> | ||
<td>Object is locked in share mode.<br/>This level allows other users to hold a Share lock, but not an Exclusive lock (allows readers but not updaters to proceed). <var>Find All Records</var> statements acquire this type of record lock for Recordsets.</td> | <td>Object is locked in share mode.<br/>This level allows other users to hold a <var>Share</var> lock, but not an <var>Exclusive</var> lock (allows readers but not updaters to proceed). <var>Find All Records</var> statements acquire this type of record lock for <var>Recordsets</var>.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 17: | Line 17: | ||
</tr> | </tr> | ||
</table> | </table> | ||
Typically, exclusive locks are used when there is an intent to update one or more of the records referenced by an object. A share lock is used to ensure a consistent view of records associated with an object, as such a lock prevents any other user from updating those records since an update requires an exclusive lock on a record. Unlocked (LockStrength None) records can be used where mechanisms other than locking are used to protect the integrity of field references, or in cases where an object is used to reference one or more records but the records are temporarily locked in share mode when they are actually referenced. | Typically, exclusive locks are used when there is an intent to update one or more of the records referenced by an object. A share lock is used to ensure a consistent view of records associated with an object, as such a lock prevents any other user from updating those records since an update requires an exclusive lock on a record. Unlocked (<var>LockStrength None</var>) records can be used where mechanisms other than locking are used to protect the integrity of field references, or in cases where an object is used to reference one or more records but the records are temporarily locked in share mode when they are actually referenced. [[LoopLockStrength (Record property)]] and [[LoopLockStrength (Recordset property)]] facilitate this kind of processing. | ||
'''Note:''' As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|"Common enumeration methods"]]. | '''Note:''' As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|"Common enumeration methods"]]. |
Revision as of 16:20, 27 November 2012
This enumeration is used to indicate the strength of a lock, and is often used in controlling locking for Record and Recordset objects. When an object referencing one or more records is instantiated, the referenced records are locked with a particular lock strength, either implicitly as with the Find All Records and Find And Reserve statements or explicitly as with the New (Record constructor) and New (Recordset constructor) methods.
These are the valid values of this enumeration, which correspond to standard Model 204 record-locking levels:
None | Object is not locked. No locks are held on the object, so there can be no conflict with others holding Share or Exclusive locks (readers and updaters may proceed). Find Without Locks statements acquire this type of record lock for Recordsets. |
---|---|
Share | Object is locked in share mode. This level allows other users to hold a Share lock, but not an Exclusive lock (allows readers but not updaters to proceed). Find All Records statements acquire this type of record lock for Recordsets. |
Exclusive | Object is locked in exclusive mode. This level prohibits others from holding either an Exclusive lock or a Share lock. It is generally used for update. Find And Reserve statements acquire this type of record lock. |
Typically, exclusive locks are used when there is an intent to update one or more of the records referenced by an object. A share lock is used to ensure a consistent view of records associated with an object, as such a lock prevents any other user from updating those records since an update requires an exclusive lock on a record. Unlocked (LockStrength None) records can be used where mechanisms other than locking are used to protect the integrity of field references, or in cases where an object is used to reference one or more records but the records are temporarily locked in share mode when they are actually referenced. LoopLockStrength (Record property) and LoopLockStrength (Recordset property) facilitate this kind of processing.
Note: As with all enumerations, the ToString method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see "Common enumeration methods".