New (Recordset constructor): Difference between revisions
m (→Usage notes) |
m (→Syntax terms) |
||
Line 20: | Line 20: | ||
<h3>LockStrength enumeration</h3> | <h3>LockStrength enumeration</h3> | ||
These are the valid values of this enumeration, which correspond to standard <var class="product">Model 204</var> record-locking levels: | These are the valid values of this [[Enumerations|enumeration]], which correspond to standard <var class="product">Model 204</var> record-locking levels: | ||
<dl> | <dl> | ||
<dt>None <dd><var>Recordset</var> is not locked. <br> No locks are held on the object, so there is 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. | <dt>None <dd><var>Recordset</var> is not locked. <br> No locks are held on the object, so there is 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. | ||
<dt>Share <dd><var>Recordset</var> is share locked. <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. <dt>Exclusive <dd><var>Recordset</var> is exclusively locked. <br> This level prohibits others from holding either an <var>Exclusive</var> lock or a <var>Share</var> lock. It is generally used for update. <var>Find And Reserve</var> statements acquire this type of record lock. </dl> | <dt>Share <dd><var>Recordset</var> is share locked. <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. <dt>Exclusive <dd><var>Recordset</var> is exclusively locked. <br> This level prohibits others from holding either an <var>Exclusive</var> lock or a <var>Share</var> lock. It is generally used for update. <var>Find And Reserve</var> statements acquire this type of record lock. </dl> | ||
'''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"]]. | |||
==Usage notes== | ==Usage notes== |
Revision as of 21:12, 16 August 2011
Create a new Recordset object (Recordset class)
This function makes a new, empty instance of a Recordset object.
Syntax
%recordset = [%(Recordset In filOrGrp name):]New[( [lockStrength], - [LoopLockStrength= lockStrength])]
Syntax terms
%newSet | An empty Recordset object created by this method. |
---|---|
%(RecordSet) | The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Recordset Constructor. |
lockstrength | The lock strength of the instantiated Recordset object. Options are LockStrength enumeration values (None, Share, or Exclusive), as described below. This is an optional parameter, and it defaults to Share. |
LoopLockStrength | The lock strength to be used for loops on records in the Recordset object. This is an optional, name required parameter, available in Sirius Mods 7.0 and later. It defaults to None. See "LoopLockStrength for Recordsets". |
LockStrength enumeration
These are the valid values of this enumeration, which correspond to standard Model 204 record-locking levels:
- None
- Recordset is not locked.
No locks are held on the object, so there is no conflict with others holding Share or Exclusive locks (readers and updaters may proceed). Find Without Locks statements acquire this type of record lock. - Share
- Recordset is share locked.
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. - Exclusive
- Recordset is exclusively locked.
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.
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".
Usage notes
- As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is Null:
%recset = new %recset = %(Recordset in file sirLocal):new %recset = %recset:new
Note: As shown above, when explicitly indicating the class, both the class name and the file context must be specified just as they are on the Recordset variable's declaration.
- Since the created Recordset object is empty, that is, contains no records, New needs to acquire no locks, so it cannot produce a record locking conflict.
- New is typically used in conjunction with AddRecord or AddRecordset, since without these methods, the object created by New is empty and therefore fairly uninteresting.
Examples
Example New statements follow:
%rs is object recordSet in foo %rs = new %rs = new( none ) %rs = new( exclusive ) %rs = new( share )