New (Record constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
{{Template:Record:New subtitle}}
{{Template:Record:New subtitle}}


 
This shared function instantiates a <var>Record</var> object that refers to a record in a group. To create a Record object that refers to a record in file context, use the same-named [[New (Record constructor)|New]] method, which has only one
This shared function instantiates a <var>Record</var> object.
required parameter in addition to one optional parameter.
It has one required parameter if in file context, two required parameters
if in group context, and one optional parameter in either context.


The parameters are applied by the <var>New</var> constructor to the newly instantiated object.
The parameters are applied by the <var>New</var> constructor to the newly instantiated object.
Line 11: Line 9:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%filerec</th>
<tr><th>%groupRecord</th>
<td>A declared <var>Record</var> object variable in file context.
</td></tr>
<tr><th>%grouprec</th>
<td>A declared <var>Record</var> object variable in group context.
<td>A declared <var>Record</var> object variable in group context.
</td></tr>
</td></tr>
<tr><th>recnum</th>
<tr><th>number</th>
<td>The number of the record to which the instantiated <var>Record</var> object will refer.
<td>The number of the record to which the instantiated <var>Record</var> object will refer.
</td></tr>
</td></tr>
<tr><th>filename</th>
<tr><th>string</th>
<td>For group context, the name of the file that contains the record that the instantiated <var>Record</var> object will reference.
<td>For group context, the name of the file that contains the record that the instantiated <var>Record</var> object will reference.
</td></tr>
</td></tr>
<tr><th>lockstr</th>
<tr><th>lockstrength</th>
<td>The value of a Lockstrength enumeration: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>. These correspond to standard <var class="product">Model 204</var> record-locking levels, as described below. The default lock strength of the new record object is <var>Share</var>, matching the locking behavior of a <var class="product">User Language</var> <var>For Record Number</var> statement. <dl> <dt>None <dd>Record 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). <dt>Share <dd>Record is share locked. <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). <dt>Exclusive <dd>Record 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. </dl>
<td>The value of a <var>Lockstrength</var> enumeration: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>. These correspond to standard <var class="product">Model 204</var> record-locking levels, as described below. The default lock strength of the new record object is <var>Share</var>, matching the locking behavior of a <var class="product">User Language</var> <var>For Record Number</var> statement. <dl> <dt>None <dd>Record 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). <dt>Share <dd>Record is share locked. <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). <dt>Exclusive <dd>Record 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. </dl>
</td></tr>
</td></tr>
<tr><th><var>LoopLockStrength</var></th>
<tr><th><var>LoopLockStrength</var></th>
Line 39: Line 34:
  %rec = %rec:new(none)
  %rec = %rec:new(none)
</p>
</p>
<li>The <var>[[LockStrength (Record property)|LockStrength]]</var> returns the locking
<li>The <var>[[LockStrength (Record function)|LockStrength]]</var> returns the locking
level of a <var>Record</var> object.
level of a <var>Record</var> object.
<li>For more information about constructors,
<li>For more information about constructors,

Revision as of 22:32, 20 April 2011

Create a new Record object (Record class)


This shared function instantiates a Record object that refers to a record in a group. To create a Record object that refers to a record in file context, use the same-named New method, which has only one required parameter in addition to one optional parameter.

The parameters are applied by the New constructor to the newly instantiated object.

Syntax

%groupRecord = %(Record):New( number, string, [lockStrength], - [LoopLockStrength= lockStrength])

Syntax terms

%groupRecord A declared Record object variable in group context.
number The number of the record to which the instantiated Record object will refer.
string For group context, the name of the file that contains the record that the instantiated Record object will reference.
lockstrength The value of a Lockstrength enumeration: None, Share, or Exclusive. These correspond to standard Model 204 record-locking levels, as described below. The default lock strength of the new record object is Share, matching the locking behavior of a User Language For Record Number statement.
None
Record 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).
Share
Record 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).
Exclusive
Record is exclusively locked.
This level prohibits others from holding either an Exclusive lock or a Share lock. It is generally used for update.
LoopLockStrength The lock strength to be used for For Record loops on the Record object. This is an optional, name required, parameter, and it defaults to None. See "LoopLockStrength for Records". This parameter is available under Sirius Mods 7.0 and later.

Usage notes

  • New is a constructor and as such can be called with no object, with an explicit class name, or with an object variable, even if that object is null:

    %rec = new(share) %rec = %(Record):new(exclusive) %rec = %rec:new(none)

  • The LockStrength returns the locking level of a Record object.
  • For more information about constructors, see "Creating object instances"
  • For more information about using New, see "Using New to instantiate a Record object".

See also