Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cascading Referential Integrity
Message
From
17/02/2011 11:28:41
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01499588
Message ID:
01500548
Views:
43
>>>>>>
>>>>>>>1. Can it be done in VFP and is it reliable/stable
>>>>>>yes, it's wrapped in a transaction
>>>>>>
>>>>>>>2. If 1. is Yes, where do you start? I want to build a rule for an update of one of the parent fields, as a test and see how it works.
>>>>>>
>>>>>>modi database
>>>>>>rightclick - Edit referential integrity
>>>>>
>>>>>Hi Gregory,
>>>>>
>>>>>Sorry to trouble you with this again. I just got to try your suggestion of creating a referential integrity. But I don't seem to see this feature. Here is what I do:
>>>>>
>>>>>Open Database MyDatabase
>>>>>Set database to MyDatabase
>>>>>Modify Database
>>>>>-. This opens all tables of in the database in the Database Designer window.
>>>>>Then I try to Right click but the menu does not have an item Edit Referential Integrity.
>>>>>
>>>>>Could you please point me to what I am missing?
>>>>>
>>>>>Thank you.
>>>>
>>>>You have to right click in the grey area or on a relationship (line)
>>>>Also possible is in the menu: Database ...Edit referential integrity
>>>>
>>>>ps: the database has to be opened exclusively if you want to edit the referential integrity
>>>
>>>I do right click in the grey area. But I don't have any relationship lines. Maybe this is what I am missing. So I need to learn how to create these relationship lines. Thank you.
>>>Do you think that maybe I am better off using RI Builder (I think it is part of VFP9, not sure though)?
>>
>>
>>There must be relationships established ( when you create table .... foreign key)
>>If no relationships are established, you can add them in Modify database
>>
>>Click on a PK from a table and drag that to a FK of the related child table - then you will see the (new) relationship (line)
>>
>>When you have all your relationships, then do the right click - Edit referential integrity
>>When you are done with that it will ask whether you want the code generated
>
>Yes, you are correct. I am reading the VFP help and that the Persistent relationship has to be established.
>
>But let me, if you don't mind, as you another question. Do I understand correctly that after I build the persistent relationship and build the RI the code in the database will be something like this (pseudo code):
>Use Table1
>update Table1 set FieldA = cSomeValue where FieldA = cOldValue
>and son on for other tables?
>
>I am just trying to have a sneak preview of what the resulting code will look like.
>
>Thank you.

Depends on the trigger and the option (ignore, .restrict..)

In case of a PK to FK Child table and Update is set to cascade
- it will be as you described
something like
if( field of pk changed )
use childtable (NO INDEX !)
scan all for FKField = oldvalue of PK
replace FKField with new value of PK
endscan
close childtable
endif
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform