Re: Trigger

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"WP" <wpaul@xxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:eZObRpm%23HHA.600@xxxxxxxxxxxxxxxxxxxxxxx
How can I write a very simple piece of code in a delete trigger so that no
orphans arise? The referential integrity builder is too complex, and
crashes my VFP9 SP2.

Assumed you've got a parent table "parent" with a primary-key field
"parent_id" and child table "child" with "parent_id" as its foreign-key
field, you could create an SP like:

Procedure ri_parent_delete()
Local luPK
luPK = parent_id && no alias name here
Delete From child Where parent_id = m.luPK
EndProc


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


.



Relevant Pages

  • Re: [PATCH] exec: Make do_coredump more robust and safer when using pipes in core_pattern
    ... When the system init daemon crashes, ... handler forks a child process, unmasking the signal in that child ... init ) going to catch a SIGSEGV from its parent? ...
    (Linux-Kernel)
  • Re: Trigger
    ... I would prefer to show a message if there are children for the parent to be ... USE parent ALIAS parent1 IN 1 ... USE child ALIAS child1 IN 2 ... Assumed you've got a parent table "parent" with a primary-key field ...
    (microsoft.public.fox.programmer.exchange)