Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling 1:M:M with views
Message
From
04/02/1999 22:52:34
Kenneth Downs
Secure Data Software, Inc.
New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00184085
Message ID:
00184187
Views:
26
Rich,

>> Let me make sure I understand your problem. You've said creating a new child orphans the grandchildren. Why? Because the
surrogate keys haven't been assigned until saving? <<

First: I assign surrogate keys to all records at record create. That being said...

As I understand it, when using views, creating the parent appends to the local view, but not through to the base table until you do TableUpdate(). Same for the children. The situation I'm describing is where three views are populated. One record in the parent, one in the child, and 1 or more in the granchild. They are all linked by surrogate and foreign keys, but nothing has been committed through to the base tables yet. The trouble comes when I attempt to add a second child record. At that point I must commit and requery the grandchild view. What I mean by "orphaned" is that the grandchild view will send its records to the base table before the parent and child have done so. The grandchild base table will now have records whose foreign key refers to a record that is not yet in the child base table. If the user cancels, and I do a TableRevert on all views, those records have still been committed/saved.

So I could force a save of the parent (and with it a resulting cascading save of child and grandchild), which solves my RI problem, but raises the problem of saving records that might not yet satisfy business rules.

I know this is rather obscure, and perhaps I'm missing something on views, but with my current understanding of views, it would be a real problem.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform