company logo

DBBaseContext :: doAfterStore - After store handler

The after-store handler is called, when a data instance has been stored ( DBO_Stored event). The handler can be overloaded in specialized property and type context class implementations. The handler is called for for type instances (type context) and property instances (property context). Besides generating the event after storing changed to attributes or type instances, the handler is also called when a collection changes (i.e. after insert, remove) but not when renaming index keys.

Within the event handler, one may update one or more properties. In this case, the instance will be stored after finishing the event handling. One may, however, also call save explicitly from within the event handler. Instance may be stored ones when handling the DBO_Stored event. Storing instances recursively this way will not cause an additional store event. Storing instances recursively more than 3 time will cause an exception (system assumes an infinite recursion).

When saving instances after being modified within a doAfterStore() handler, indexes are not updated, i.e. changes must not apply on sensitive attributes (attributes, which are referred to as key components). When updating key components within the event handler, the event handler has to store data explicitly calling Property ::save() .

In case of copying or duplicating data, the context instance provides a reference context ( TypeContext ::referenceContext() ) , which refers to the source instance.

Notes:

Not storing key attribute modifications explicitly will result in index damage.

Return value:  Execution error ( int32  )

The value is usually returned from context functions or actions in order to report the result of execution. The variable may contain following values:

  • -1: function/action not executed
  • 0: function executed normally
  • 1-9: Function executed with errors. Error codes depend on the function/action called.

Implementation details

int32 DBBaseContext  :: doAfterStore (  )