RecordLockingConflict class: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<!-- RecordLockingConflict class --> | <!-- RecordLockingConflict class --> | ||
__NOTOC__ | |||
The <var>RecordLockingConflict</var> exception class catches record locking conflict errors thrown by file object operations; that is from methods in the <var>[[File_classes|file]]</var> (that is: <var>[[Record_class|Record]]</var>, <var>[[Recordset_class|Recordset]]</var>, <var>[[SortedRecordset_class|SortedRecordset]]</var>, and <var>[[RecordsetCursor_class|RecordsetCursor]]</var>) classes. | The <var>RecordLockingConflict</var> exception class catches record locking conflict errors thrown by file object operations; that is from methods in the <var>[[File_classes|file]]</var> (that is: <var>[[Record_class|Record]]</var>, <var>[[Recordset_class|Recordset]]</var>, <var>[[SortedRecordset_class|SortedRecordset]]</var>, and <var>[[RecordsetCursor_class|RecordsetCursor]]</var>) classes. | ||
Line 80: | Line 81: | ||
<b><i>Note:</i></b> that the For statement can be on the same line as the <var>Try</var>, or it can be inside the <var>Try</var> block. | <b><i>Note:</i></b> that the For statement can be on the same line as the <var>Try</var>, or it can be inside the <var>Try</var> block. | ||
The methods in | |||
<h2>The RecordLockingConflict methods</h2> | |||
{{Template:List of RecordLockingConflict methods}} | |||
The methods in the class are described in the subsections that follow. In addition: | |||
<ul> | |||
<li>[[Notation conventions for methods|"Notation conventions for methods"]] has information | |||
about the conventions followed. | |||
<li>[[RecordLockingConflict methods syntax|"RecordLockingConflict methods syntax"]] is a single page that contains the syntax diagrams of all the methods in the class. | |||
</ul> | |||
<h2>New constructor</h2> | |||
[[Category:System exception classes]] | [[Category:System exception classes]] |
Revision as of 19:03, 10 May 2011
The RecordLockingConflict exception class catches record locking conflict errors thrown by file object operations; that is from methods in the file (that is: Record, Recordset, SortedRecordset, and RecordsetCursor) classes.
An exception is thrown only if there is a Catcher for the exception.
There is no distinction between a Find conflict and a record locking conflict. For example, you can use the following:
try fd to %foo ... end find catch recordLockingConflict ... end try
And you can also use:
try %rec = new(%recnum, exclusive) for record %rec ... end for catch recordLockingConflict ... end try
You can even catch record locking conflicts caused by LoopLockStrength promotions during a loop:
%rec = new(%recnum, none, loopLockStrength=share) ... try for record %rec ... end for catch recordLockingConflict ... end try
Or as in the following:
%curser = new(%recset, loopLockStrength=none) ... try for record at cursor %curser ... end for catch recordLockingConflict .. end try
Or as in this example:
fdwol to %recset = new(loopLockStrength=exclusive) ... end find ... try for each record in %recset ... end for catch recordLockingConflict ... end try
In the latter example, note that any iteration of the For loop can throw an exception, and there is no way of picking up where you left off (at the next record, say) if you get a RecordLockingConflict exception in such a case. So, unless you always want to lose the whole loop on a record locking conflict, such a case is almost always better structured with a cursor on the recordset and with Try around the For Record At Cursor loop:
fdwol to %recset = new(loopLockStrength=exclusive) ... end find ... %curser = new(%recset, loopLockStrength=exclusive) repeat while %curser:state eq hasRecord try for record at cursor %curser ... end for catch recordLockingConflict ... end try %curser:next end repeat
Note: that the For statement can be on the same line as the Try, or it can be inside the Try block.
The RecordLockingConflict methods
The following are the available RecordLockingConflict class methods.
Method | Description |
---|---|
ConflictTimeMilliseconds | Time that the conflict occurred |
ConflictingLockStrength | Lock strength of conflicting lock |
ConflictingRecordLockType | Lock type of conflicting lock |
Copy | Copy the RecordLockingConflict object |
DeepCopy | Deep copy the RecordLockingConflict object |
Filename | Name of the file in which last record locking conflict occurred |
LockTimeMilliseconds | Time that the conflicting record was locked |
LockingUserNumber | User number of the user that locked the conflicting record |
New | Create a new RecordLockingConflict object |
NewFromLastConflict | Create object from current conflict information |
RecordNumber | Record number of the record that has the conflict |
UserID | User ID (login name) of the user that has the conflict |
UserNumber | User number of the user that has the conflict |
The methods in the class are described in the subsections that follow. In addition:
- "Notation conventions for methods" has information about the conventions followed.
- "RecordLockingConflict methods syntax" is a single page that contains the syntax diagrams of all the methods in the class.