> > Yes, you need to delete everything manually that is referenced by
> > anything that is to be deleted.
>
>    No, you don't. .destroySelf() in SQLObject 0.7.2 was extended to
> automatically remove rows from the intermediate table. Does it work?

Maybe I'm misunderstanding you but if a foreignkey points to an object
that is deleted, the object that refers to the deleted object will not
be:



from sqlobject import *

sqlhub.processConnection = connectionForURI( 'sqlite:/:memory:' )

class city( SQLObject ):
    buildings = MultipleJoin( 'building' )

class building( SQLObject ):
    city = ForeignKey( 'city' )

city.createTable( )
building.createTable( )

c = city( )
b1 = building( city=c )
b2 = building( city=c )

c.destroySelf( )

print building.select( ).count( )
print b1.city


This will print 2 and then an SQLObjectNotFound exception will be
raised so you need to manually delete all buildings that refer to a
deleted city. I guess you had RelatedJoin in mind.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to