DBBaseContext :: doAfterInsert - After inserted handler
The after insert handler is called when a data instance has been inserted in a collection ( DBO_Inserted event). In contrast to create, insert only means, that an existing instance has been added to a collection without creating a new instance.
Usually, an instance is selected in the property handle after being inserted. In case of maintaining inverse references or extent hierarchies, however, the instance state is usually located, but not selected. In order to access instance data, the instance in the parent.parent property may be referred to, or the instance has to be read explicitly.
The handler can be overloaded in specialized property context class implementations.
// maintaining inverse persons reference in cars after adding a car to Person::cars
... pCar_persons :: doAfterInsert () {
Property persons(property()); // not selected, but located
Property cars(persons.parent());
if ( !persons.selected() )
persons.get(); // get located instance
// now do what is necessary
return(false);
}
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.