New (RecordsetCursor constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
{{Template:RecordsetCursor:New subtitle}}
[[Category:RecordsetCursor methods|New constructor]]
<p>
<var>New</var> is a member of the <var>[[RecordsetCursor class|RecordsetCursor]]</var> class.
</p>


This shared function instantiates a <var>RecordsetCursor</var> object.
This shared function instantiates a <var>RecordsetCursor</var> object.
Line 13: Line 9:
in [[RecordsetCursor class#Declaration and instantiation|"Declaration and instantiation"]].
in [[RecordsetCursor class#Declaration and instantiation|"Declaration and instantiation"]].
==Syntax==
==Syntax==
<p class="syntax">%rscursor = [class:]New( %recset [,&nbsp;LoopLockStrength=ls] )
{{Template:RecordsetCursor:New syntax}}
</p>
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
Line 31: Line 26:


</td></tr></table>
</td></tr></table>
==Usage Notes==
==Usage notes==
<ul>
<ul>
<li>If ''%recset'' is empty, New returns a <var>RecordsetCursor</var>
<li>If ''%recset'' is empty, New returns a <var>RecordsetCursor</var>
Line 55: Line 50:
The <var>Cursor</var> method constructor cannot be used for this purpose.
The <var>Cursor</var> method constructor cannot be used for this purpose.
</ul>
</ul>
==See also==
{{Template:RecordsetCursor:New footer}}

Revision as of 22:48, 26 April 2011

Create a new RecordsetCursor object (RecordsetCursor class)


This shared function instantiates a RecordsetCursor object. The method requires a Recordset or SortedRecordset object parameter, and it may have a LoopLockStrength.

Available as of Sirius Mods version 7.6, the New method is an alternative to using the (Recordset or SortedRecordset) Cursor constructor, as described in "Declaration and instantiation".

Syntax

%recordsetCursor = [%(RecordsetCursor In filOrGrp name):]New( recordset, - [LoopLockStrength= lockStrength])

Syntax terms

%rscursor A declared RecordsetCursor object including its file/group context.
class Either a parenthesized class name, as in %(RecordsetCursor in file bar), or a non-parenthesized variable in the class, as in %rscursor.
%recset A required Recordset or SortedRecordset object.
LoopLockStrength This optional, name required, parameter is a LockStrength enumeration setting the minimum lock strength for a record in a For Record At loop on a RecordsetCursor object. Options are None (default), Share, or Exclusive, further described in CurrentRecord.

For more information about loop lock strength, see "LoopLockStrength for RecordsetCursors".
Note: This parameter is only valid if %recset is a Recordset object.

Usage notes

  • If %recset is empty, New returns a RecordsetCursor object with the state Empty. This is different from the Cursor methods of instantiation, which return a null if %recset is empty.
  • When a RecordsetCursor is instantiated, it is automatically positioned on the first record in the set (state=HasRecord).
  • You can have as many cursors as you want for a RecordsetCursor.
  • If you are creating an extension class of the RecordsetCursor class, you can use New in the Construct statement in the extension class:

    class myrecSetCurse extends RecordsetCursor - in file test inherit ... constructor new construct %(RecordsetCursor):new(%sortedRecset) ... end constructor ... end class

    The Cursor method constructor cannot be used for this purpose.

See also