On Sep 22, 2006, at 6:27 AM, Simen Haugen wrote:

How can I add constraints to my bizobjs so they don't delete child rows
when I delete a parent row?
It's already set up that way in my database, but dabo doesn't care about
those and wants to delete them anyway.

That's because that is the default setting for referential integrity. Here's the relevant section of dBizobj:

  88 ##########################################
  89 ### referential integrity stuff ####
  90 ##########################################
91 ### Possible values for each type (not all are relevant for each action):
  92 ### IGNORE - don't worry about the presence of child records
  93 ### RESTRICT - don't allow action if there are child records
  94 ### CASCADE - changes to the parent are cascaded to the children
95 self.deleteChildLogic = k.REFINTEG_CASCADE # child records will be deleted 96 self.updateChildLogic = k.REFINTEG_IGNORE # parent keys can be changed w/o
  97                                                                    # 
affecting children
98 self.insertChildLogic = k.REFINTEG_IGNORE # child records can be inserted
  99                                                                    # even 
if no parent record exists.
100 ##########################################

In your bizobj, you can override the setting by adding in the afterInit():

import dabo.dConstants as k
self.deleteChildLogic = k.REFINTEG_IGNORE

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to