%Library.SerialObjectabstract serial class %Library.SerialObject
The %SerialObject class builds upon the functionality provided by the
A serial object is converted to a delimited string containing the object's property values when it is projected via ODBC. ODBCDELIMITER is the delimiter character used to construct the delimited string.
This parameter specifies the delimiter character used when created a serialized version of the object. If the parameter is set to null string ("") then a length delimited ($List) string is used which can be manipulated using the
If true, %ValidateObject will return $$$OK for instances that are null as determined by %IsNull(). If FALSE (the default), %ValidateObject will perform a full validation on the instance, even if it is null. This means that if VALIDIFNULL is TRUE then the property constraint, REQUIRED, can be defined without causing failures on null objects. It is important to note that a property with an INITIALEXPRESSION that returns a non-null initial value will cause %IsNull() to return FALSE for a new, otherwise unmodified instance.
Deletes streams referenced by this object and calls %Delete on any embedded objects Refer to Object Concurrency Options for more details on the optional concurrency argument.
%Statusvalue indicating success or failure.
Deletes the stored version of the object with ID id from the database.
%DeleteIdis identical in operation to the %Deletemethod except that it uses and Id value instead of an OID value to find an object. Refer to Object Concurrency Options for more details on the optional concurrency argument.
%GetSwizzleObject() is used to obtain the serial value of the object that can later be used by %SetSerial() to restore the object. It calls %SerializeObject() which returns the serialized state of the object or the OID (for persistent objects). Before calling %GetSerial(), %GetSwizzleObject() calls %AddToSaveSet([force]) which will result in calling the %GetSwizzleObject() method of other referenced objects, passing along the value of force.
%GetSwizzleObjectautomatically detects and handles circular references between objects. For example, %GetSwizzleObjectwill detect if object A refers to object B and object B likewise refers to object A. In this case it will avoid falling into an infinite, recursive loop.
Note that either reference attribute, A to B or B to A, can be specified as being a required attribute but not both of them. If both reference attributes are required then
%GetSwizzleObjectautomatically manages transactions. You can enable and disable automatic transaction support using the
%GetSwizzleObjectserializes an object, it initiates one transaction (by calling TSTART) for the entire set of serializations, including the original object and any related objects. If the serialization operation is successful, %GetSwizzleObjectwill issue a TCOMMIT command to commit the transaction and write the data to the database. If %GetSwizzleObjectencounters an error during the transaction it rolls back the entire transaction and performs the following actions:
- It issues a TROLLBACK command to rollback any changes to the database that may have occurred. (In the case of persistent objects with system assigned ids changes to the on-disk counter value, used to determine the next available object id number, are not rolled back.)
- It attempts to restore the in-memory state of all the objects involved in the transaction to their pre-transaction state. This includes restoring any modified flags, and restoring to null ("") any OID values that have been assigned during the course of the transaction. Additional property values changed during the course of the transaction are not restored, however.
- It calls the
%RollBackmethod on each object involved with the transaction. The order in which the %RollBackmethods are called is undefined. %RollBackwill call a user-written %OnRollbackmethod if it is present.
%Statusvalue indicating success or failure.
Returns true if this is a "NULL" serial object. Subclasses of %SerialObject are expected to override this method. The default implementation returns 0 (false) indicating that the serial object is not null. The default serialization class will generate an IsNull method that checks each property for null and if all are null then IsNull() is 1 (true).
Creates an instance (in-memory version) of a serial object from the serialized value initvalue. Note that concurrency is not used, the argument is kept to keep the interface consistent with
%Library.Persistent. If an error occurrs it is returned by refence in sc.
Swizzles a serial object from the value passed and returns an OREF referring to the object. initvalue is the Id (serial value, not a full OID) value of the object to swizzle.
%OpenIdreturns an OREF value that refers to the in-memory object instance.
Converts the serial state of this serial object to a delimited string using the value of the ODBCDELIMITER parameter as a delimiter.
Converts the value of an incoming delimited string to a serialized state using the value of the ODBCDELIMITER parameter as a delimiter.