Paul McNett wrote: > Ed Leafe wrote: >> On Apr 16, 2008, at 11:34 PM, Carl Karsten wrote: >> >>> I can see 2 reasonable was to implement it: >>> >>> 1. list of deleted items. >>> 2. "deleted" virtual field. >>> >>> In both cases, you are storing something, and committing it later. >> >> These are both highly problematic. Using database transactions is >> much cleaner. > > Except Uwe's point is well-taken: database transactions shouldn't be > kept open for a potentially long time. > > I don't understand the deleted virtual field idea: I don't want to > expose the deleted records at all.
similar to VFP's deleted flag. all rows get a _delete field. when .save() is looping over changes, it would issue DELETE when _delete=True. > But I'm trying to understand why a > list of deleted items would be highly problematic - I just don't see how > it would be much different than the memento list of changed fields or > new records. > > So when a record is deleted, here's what I think should happen: So when a record is *flagged for delete*, here's what I think should happen: Until it is deleted, it isn't deleted. > > + the record moved from cursor.records to cursor.deleted (delete the > record from cursor.records completely, resulting in adjusted RowCount). > cursor.deleted also saves the original RowNumber. > > + biz will have to iterate children of the deleted item to also delete > those, if referential integrity is set to CASCADE. Or forbid the delete > if RESTRICT. Or not cascade if IGNORE. > > + on cancel(), deleted records are moved back, and we attempt to put > them back in the original position in the recordset. doesn't .cancel dump add the data? also, I don't think attempting to maintain order is good. The fact that the set can be ordered implies that you can change the order, and so if you delete, then reorder, then .cancel... where would the original position be? > > + on save(), DELETE statements are executed for the records in the > deleted list, and the deleted list cleared. > > + functions like isAnyChanged() take into account the existence of > records marked for deletion. > > I know this is easier said than done. Sounds like you need to do it somewhere, and doing it in the framework will be easier than in your app. Carl K _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]
