From: Chuck E. <ec...@mi...> - 2001-03-27 04:57:41
|
At 11:43 PM 3/26/2001 -0500, Dave Rogers wrote: >Chuck Esterbrook wrote: > > In Python, you will do this to delete an object: > > > > store.deleteObject(foo) > >I prefer this - would it set foo to None after this? Probably not. Foo is just a parameter; the deleteObject() method can't really set it (barring some serious black magic). Note that if foo is local it will go out of scope. And the object doesn't really disappear until changes are saved, although your code will be more clear if you save deleting for after you are really finished with the object. I suppose the object could reside in memory due to references from other Python objects/data structures. Upon committing the change, I think I should wipe the object's attribute and set it's class to some uncooperative DeletedObject class that raises an exception if you even dare look in its direction. >Sounds like a foreign key :-) These are "delete rules". :-) They seem pretty important both in OOP and RDB. What little I have looked at UML hasn't revealed anything equivalent there which surprised me. Perhaps I haven't dug hard enough. >Sounds good - the deny seems like a function of a foreign key. >Perhaps this could be what also triggers the foreign key SQL in the DDL. >I originally considered this to a True/False for any given reference, but >the extras could be what determines it. > >I guess the issue might be if you do NOT want a foreign key in the >database but do want "deny". I guess since your primary DB is MySQL this >mind sounds like lame stuff but its useful to think about. I have trouble thinking about it since I haven't actually used FKs at the DB level. I've read about them, but the details aren't in my head and probably change from DB to DB. I will say this though: Each specific SQL adapter is free to use the information in the object model to generate the best SQL it can both at design time and run time. >If the behavior is mark, you may want to have a column that saves the >date/time it was marked You also may want a column that specifies who >marked it for deletion Yeah, the delete column can be NULL for not deleted and the timestamp for deletion. I suppose most modern DBs give you a function for the who, so that could be recorded as well. Out of laziness, I could defer that particular enhancement. I'll update the WEP with these notes. -Chuck |