Copy (Recordset function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span> Copy and DeepCopy functions <p> <var>Copy</var> and <var>DeepCop...")
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
#REDIRECT [[Copy and DeepCopy (Recordset functions)]]
[[Category:Recordset methods|Copy and DeepCopy functions]]
<p>
<var>Copy</var> and <var>DeepCopy</var> are members of the <var>[[Recordset class|Recordset]]</var> class.
</p>
 
<var>Copy</var> is a function that makes a copy of a <var>Recordset</var> object.
<var>DeepCopy</var> is a version 6.8 function that performs the identical function
as <var>Copy</var>, but flags the <var>Recordset</var> class as "deep-copyable"
(as described in [[Copying objects#The Object class copy methods|"The Object class copy methods"]]).
==Syntax==
<p class="syntax">%newSet = %recSet:Copy( [lockstrength]        -
                      [,&nbsp;LoopLockStrength=lockstrength] )
 
%newSet = %recSet:DeepCopy([lockstrength]    -
                        [,&nbsp;LoopLockStrength=lockstrength] )
</p>
===Syntax Terms===
<table class="syntaxTable">
<tr><th>%newSet</th>
<td>A <var>Recordset</var> object created by this method that contains a copy of the method object.
</td></tr>
<tr><th>%recSet</th>
<td>A <var>Recordset</var> object variable. The variable can be null, in which case the output object will also be null.
</td></tr>
<tr><th>lockstrength</th>
<td>A value of the <var>LockStrength</var> enumeration that is the lock strength to give to the instantiated <var>Recordset</var> object. Options are: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>, as described in [[New (Recordset constructor)|"New (Recordset constructor)"]]. This is an optional parameter, and it defaults to the lock strength of the method object. Specifying a stronger <var>LockStrength</var> than the method object's lock strength is invalid and results in request cancellation.
</td></tr>
<tr><th><b>LoopLockStrength=</b>lockstrength</th>
<td>The lock strength to be used for loops on the copied <var>Recordset</var>. This is an optional, name required, parameter, and it defaults to the <var>LoopLockStrength</var> of the method object <var>Recordset</var>. This parameter is only available in <var class="product">Sirius Mods</var> 7.0 and later. See [[Recordset class#LoopLockStrength for Recordsets|"LoopLockStrength for Recordsets"]].
 
</td></tr></table>
==Usage Notes==
<ul>
<li>You can only create a copy of lock strength less than
or equal to the original, so <var>Copy</var> needs to acquire no locks
that the user does not already hold.
Therefore, <var>Copy</var> cannot produce a record locking conflict.
<li>Specifying a lock strength greater than the lock strength of the method
object is a request-cancelling error.
</ul>
==Example==
 
In the following example, a base record set is created, copied, then added to:
<p class="code"> begin
  %baseStooges is object recordset in file glwproc
  %copyStooges is object recordset in file glwproc
  %curleyStooge is object recordset in file glwproc
 
  fd to %baseStooges name = 'MOE' or name = 'LARRY'
      end find
  text
      ------
      The names of the %baseStooges are:
  end text
  fr in %baseStooges
      text
        {name}
      end text
  end for
 
  %copyStooges = %baseStooges:copy
  fd to %curleyStooge with name = 'CURLEY'
      end find
  %copyStooges:addRecordset( %curleyStooge )
  text
      ------
      The names of the {%copyStooges:Count} %copyStooges are:
  end text
  fr in %copyStooges
      text
        {name}
      end text
  end for
end
</p>
 
The example results follow:
<p class="output"> ------
The names of the %baseStooges are:
MOE
LARRY
------
The names of the 3 %copyStooges are:
MOE
LARRY
CURLEY
</p>

Latest revision as of 22:40, 6 November 2012