Loading...
 

CopyPersObject

CopyPersObject

CopyPersObject(mode, pattern), CopyPersObject(mode), CopyPersObject(, pattern), CopyPersObject

Parameters: integer value for copy mode, bit pattern for ineritance

Stack
Stack Description
Stack(In) one object
Stack(Out) a persistent copy of this object

This statement creates a persistent object, which is a copy of the persistent or transient object found on the stack. (See also the InstantView® command CopyTransObject, which creates a transient copy of an object, and also the CopyPersObject() function of the Object Manager)

If no parameters or only Mode or only Pattern are transferred, the default value is assumed for the missing parameter. This is 0 for the mode and -1 for the pattern.

How an object is copied is determined by the class of the object (a detailed description can be found here). To allow different modes of copying for the same class, the optional parameter to be specified is passed to the virtual function PersistentCopy() (default value is zero).

As with the CreatePersObject statement, the definition of the database layout in CLASSIX.INI determines in which segment the object is stored and in which collections it is included. The settings made with SetLayer, SetDomain(WRITE) and SetPattern are decisive (see figure).

In the ClassiX® system different strategies for clustering the objects can be activated. There are rules that decide whether an object to be created is a master or a slave object. Master objects know the location in the database where they are stored. For slave objects, only an already stored object, to which they are connected via a relation, determines the location in the database. For slave objects the object creation is delayed: CopyPersObject creates an object of the class CX_LAZY_CREATOR. This object "remembers" first only the object to be copied. The "real" persistent object is only created when the CX_LAZY_CREATOR object is linked to another object, e.g. with instructions like SetReference, Insert...
If all clustering strategies are deactivated, there are only master objects.

Attention!
If you make a persistent copy of another persistent object, and the objects belong to a class which normally has a REP-Collection, but in this case the original object was created with CreatePersObject(CX_XXXXX, 0), so it is not in the REP-Collection, the persistent copy will still be put into the REP-Collection if you do not call CopyPersObject(, 0) !