Copy and DeepCopy (Recordset functions)
Copy or deep copy this Recordset object (Recordset class)
Copy is a function that makes a copy of a Recordset object.
DeepCopy performs the identical function
as Copy, but it flags the Recordset class as "deep-copyable"
(as described in "The Object class copy methods").
Syntax
%outRecordset = recordset:Copy[( [lockStrength], - [LoopLockStrength= lockStrength])]
%outRecordset = recordset:DeepCopy[( [lockStrength], - [LoopLockStrength= lockStrength])]
Syntax Terms
%outRecordset | A Recordset object created by this method that contains a copy of the method object. |
---|---|
recordset | A Recordset 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 Recordset 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. Specifying a stronger LockStrength than the method object's lock strength is invalid and results in request cancellation. |
LoopLockStrength | The lock strength to be used for loops on the copied Recordset. This is an optional, name required, parameter, and it defaults to the LoopLockStrength of the method object Recordset (see "LoopLockStrength for Recordsets"). |
Usage Notes
- You can only create a copy of lock strength less than or equal to the original, so Copy needs to acquire no locks that the user does not already hold. Therefore, Copy cannot produce a record locking conflict.
- Specifying a lock strength greater than the lock strength of the method object is a request-cancelling error.
Example
In the following example, a base record set is created, copied, then added to:
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 noCont ------ 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 noCont ------ The names of the {%copyStooges:Count} %copyStooges are: end text fr in %copyStooges text {name} end text end for end
The example results follow:
------ The names of the %baseStooges are: MOE LARRY
The names of the 3 %copyStooges are: MOE LARRY CURLEY