Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem With cascading saves, triggers and the framework
Message
From
06/09/2002 19:05:07
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Problem With cascading saves, triggers and the framework
Miscellaneous
Thread ID:
00697823
Message ID:
00697823
Views:
63
I need some help wraping my brain around how to handle this situation.

I'm working on a system that uses either foxpro or SQL data.

I'm using the bizness objects pretty heavely and I have a fairly heavy hierarchy of objects in a perticular part of the application. We delete the parent object, and in doing so delete the children as well. I've got cascading saves on for this hierarchy (because its needed when saving of course!) I also have some code in my bizness objects that are cascading deletes in the views. The database enforces data integrity with triggers on most of the relationships, but in a sense so does this part of the application.

In foxpro all this works swimmingly. In SQL there is a problem. When saving the bizness objects a parent will save, the changes are sent to the sql server, and the database triggers delete the child records. When the parent bizness object cascades and tries to save its children the table updates fail when there are child reccords in the views, because the database has already deleted them, it causes an update error saying (another user has already changed the data etc etc...) In foxpro this dosn't happen because although they are deleted the reccords are still there (deleted), but in SQL they are gone for good and it can't update that reccord.

I can't stop cascading saves because I need to save changes other than deletes in child tables in this process. I could get rid of the triggers but I'm striping down the data integrity on the database this way. Not cascading the deletes in the model dosn't work either because it would still be trying to update reccords that no longer exist, just not deleting them.

The only other thing I can think of is to do the save cascading on the children before saving the parent, but that would be a big change to the framework classes, I'm not sure how wise it would be.

Anyone (Kevin especialy) have any other ideas I'm missing here? Has anyone dealt with this problem? I don't see how to avoid it without changing the database or the framework.
Sigfried Trent, aka FoxMan
(Working from his secret code cave, FoxMan battles the forces of darkness lead by the deranged and mysterious Bug Boy)
Next
Reply
Map
View

Click here to load this message in the networking platform