%Library.Populate
Class %Library.Populate [ Abstract, Not ProcedureBlock, PropertyClass = %Compiler.Type.Populate, System = 2 ]
For details on using this class, see Using the Populate Utility.
%Populate is a utility class that provides the ability to create instances of an object populated with random data.
To use the %Populate class do the following:
- Create a persistent object class, such as Employee.
- Add %Populate to the end of the class' superclass list:
super = %Persistent,%Populate
- Save and compile the class.
- %Populate will add a class method, Populate(), to your class.
Run this method to create instances of your class in the database:
Do ##class(Employee).Populate(100)
Parameters
POPSPEC;
Parameter POPSPEC;
The POPSPEC parameter provides a way to control how %Populate generates data for properties.
For details, see Using the Populate Utility.
Methods
Populate
ClassMethod Populate(count As %Integer = 10, verbose As %Integer = 0, DeferIndices As %Integer = 1, ByRef objects As %Integer = 0, tune As %Integer = 1, deterministic As %Integer = 0) As %Integer [ CodeMode = generator, GenerateAfter = OnPopulate ]
Creates up to count instances an object and stores them in the database.
If verbose is true, then details are echoed to the console.
If DeferIndices is true, then indices are sorted at the end of the operation.
If objects is true, then each object that is created is returned in the objects array
If tune is true, then $SYSTEM.SQL.TuneTable is called after the instances of the class have been created. If tune>1, then $SYSTEM.SQL.TuneTable is also called for any tables projected by persistent superclasses of this class
If deterministic is true, then the set of objects produced by identical calls to Populate at different times will be identical.
Returns the number of instances successfully created.
For details, see Using the Populate Utility.
GetSuperExtents
ClassMethod GetSuperExtents(pClass) As %String [ Internal, ServerOnly = 1 ]
Given a class, return a '~' delimited list of the class's super extents
PopulateSerial
ClassMethod PopulateSerial() As %String [ CodeMode = generator, GenerateAfter = OnPopulate ]
Create a single instance of a serial object.
OnPopulate
Method OnPopulate() As %Status [ Abstract, ServerOnly = 1 ]
Random
ClassMethod Random(n As %Integer) As %Integer [ Internal, ProcedureBlock = 1 ]
Return a random number from 0-n using a seeded RNG. Identical to $$$PRand