Loading...
 

SetReference

SetReference

SetReference(access expression), SetReference(access expression, backRef), SetReference(STACK, STACK )

Parameters: an access expression, name of the back reference.

Stack
Stack Position Description
Stack(In) Top Target object
Top 1 referenced object
Stack(Out) Top -

Attention!
outdated, please use link

After this operation, the pointer p reached from the target object via the access expression should point to the object on stack-top-1.
If the pointer selected in the target object has been declared in the DDI as a 1-1 or 1-m reference, the name of a back reference must be specified as the second operand.

 setreference.bmp (665670 byte)

If p != NULL (before the operation), the previous valid back reference is resolved first. Then p and the (new) back reference (pointer or collection) are set. SetReference is controlled by entries in the DDI and terminates with an error if an attempt is made to build a reference that contradicts the specifications made in the DDI. This is the case if

  • the data type of the object to be referenced does not match the reference data type entered in the DDI (i.e. the object to be referenced is not an instance of the class entered in the DDI or a class derived from it)
  • the object o containing the pointer p does not match the BackReference data type entered in the DDI (i.e. object o is not an instance of the class entered in the DDI as BackReference type or a class derived from it)
  • the reference found at the start of the operation contains a type conflict with the DDI in terms of outward or backward reference
  • with a 1-1 relation the back reference does not point to object o at all
  • for a 1 m relation object o is not an element of the backreference collection

A persistent object must never reference a transient object, this concerns outward and return reference. The following references are allowed:

transient persistent
transient allowed permitted with restrictions
persistent prohibited allowed

A transient object may reference a persistent one if

  • the pointer is a dynamic data field and
  • is of type POINTER (REL_11 or REL_1M would force a backreference from the persistent to the transient object and this is forbidden).

Note: When a persistent object takes part in the operation, a transaction starts.