Copy (Record 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 function <var>Copy</var> is a function that makes an exact co...")
 
mNo edit summary
Line 1: Line 1:
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
{{Template:Record:Copy subtitle}}
[[Category:Record methods|Copy function]]


<var>Copy</var> is a function that makes an exact copy of a <var>Record</var> object.
<var>Copy</var> is a function that makes an exact copy of a <var>Record</var> object.
Line 46: Line 45:
</p>
</p>
</ul>
</ul>
==See also==
{{Template:Record:Copy footer}}
[[Category:Record methods|Copy function]]

Revision as of 21:12, 15 April 2011

Copy this Record object (Record class)


Copy is a function that makes an exact copy of a Record object. It is identical to the Record DeepCopy method. Record objects are always copyable and "deep-copyable" (as these terms are described in "The Object class copy methods").

Syntax

%newRec = %rec:Copy( [lockstrength] - [, LoopLockStrength=lockstrength] )

Syntax Terms

%newRec A Record object created by this method that contains a copy of the method object.
%rec A Record object variable. The variable can be null, in which case the output object will also be null.
lockstrength A value of the LockStrength enumeration that is the lock strength to give to the instantiated Record object. Options are: None, Share, or Exclusive, as described in "New (Recordset constructor)". This is an optional parameter, and it defaults to the lock strength of the method object. This parameter is only available in Sirius Mods 7.0 and later.
LoopLockStrength The lock strength to be used for loops on the copied Record. This is an optional, name required, parameter, and it defaults to the LoopLockStrength of the method object Record. See "LoopLockStrength for Records". This parameter is available in Sirius Mods 7.0 and later.

Usage Notes

  • Before Sirius Mods 7.0, Copy did not allow setting of the target lock strength. So, before Sirius Mods 7.0, to make a Record object copy with a different lock strength, the New or CurrentRecord (inside a For record loop) methods had to be used.
  • Since a Record object and its copy reference the same underlying record, there generally isn't a good reason to make a copy of a Record object — it makes more sense to just assign the reference to the Record object. The copy functionality for Records is mainly for the support of DeepCopy of Record objects to facilitate passing of these objects to and from daemons.
  • The following example illustrates the use of the Copy function:

    %firstRec is object record in file geeks %currentRec is object record in file geeks ... %currentRec = %firstRec:copy

See also