Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Relationship between Tables
Message
From
27/05/1998 06:28:26
 
 
To
26/05/1998 20:27:57
Tan Gay Cheong
Cybercomp Computer Services
Singapore, Singapore
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00101487
Message ID:
00102279
Views:
35
You do not need additional update or delete code in RI for update or delete unless you have exceptional needs beyond restrict or cascade.

The RI will append a new child record *if* you put the code to do so in your "addchild()" RI procedure. For example -- Assuming TestDad is the parent and TestSon is the child (and I have Addson() defined as the Insert trigger on Testdad)

PROCEDURE addson
LOCAL lWasused
IF USED('testson')
lWasUsed=.T.
ELSE
lWasUsed=.F.
ENDIF
INSERT INTO testson (pk,fk,sonname) VALUES (SYS(2015),testdad.pk,"Son of "+testdad.name)
IF !lWasUsed
USE IN testson
ENDIF
RETURN .T.





>How about the update and delete trigger? Should I have procedure to control the trigger in the table or should I set it in the RI between the two relationship?
>
>By the way, will the RI append a new record in the child table when I append a new one in the parent table?
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform