Użytkownik Vineet Deodhar napisał:
> I have "RESTRICT" at DB level.
> Whenever I wish to delete a parent record, I am in a fix (irrespective
> of REFINTEG=3 or 2 in dabo).
> Because at DB level, it will not allow to delete a parent row when child
> rows are there referencing this parent row).
>
> That's why I need to delete the child rows in order from bottom to top
> in beforeDelete().
> Then delete the parent.

Ok, now I understand. Any security rationale for doing that?
It's very unhandy.
In this situation you should use framework REFINTEG_RESTRICT integrity rule,
then write deleteUpward() method yourself, e.g.:

<code>
        def deleteUpward(self, startTransaction=True):

                startTransaction = startTransaction and self.beginTransaction()
                try:
                        self.deleteAll(startTransaction=False)
                        parent = self.Parent
                        if parent:
                                parent.deleteUpward(startTransaction=False)
                        if startTransaction:
                                self.commitTransaction()
                except (dException.DBQueryException, StandardError):
                        if startTransaction:
                                self.rollbackTransaction()
                        raise
</code>

Conditionally, you can use beforeDelete method, but remember that there will
be no single transaction, but one per business object.
-- 
Regards
Jacek Kałucki
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/4e9aae08.1010...@rz.onet.pl

Reply via email to