company logo

PropertyDefinition :: autoDeleteEmpty - AUTO_DELETE option

The option can be set in order to indicate, that an instance should be deleted, when a collection (relationship) becomes empty. When the option has been defined for more than one relationship, the instance will be deleted automatically, when the first marked collection becomes empty.

The option is not checked, when creating an instance, but only, when removing instances from collections. In order to handle the option properly, relationships requesting autodelete require an inverse relationship. Otherwise, the option will be ignored.

// delete course instances when the last student has left the course

  class course {

     ...

     relationship set<Person> students AUTO_DELETE;

  }

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false .

Implementation details

bool PropertyDefinition  :: autoDeleteEmpty (  )

If the function is not called with a valid database property definition it throws an exception.