Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger Usage
Message
From
17/03/2004 10:20:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/03/2004 10:16:43
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00887019
Message ID:
00887076
Views:
18
>>>Hi, I think I need a better understanding of the use of Triggers.
>>>
>>>Here is the situation. I have a table of financial transactions (FINXN). When I want to close a period and "cast it in stone" I flag the FINXN records that I do not want the user to be able to change/delete. The flag is accomplished by entering a value other than 0 into an integer field in FINXN ala Finxn.closep_ID = 8.
>>>
>>>In the DBC I have two triggers on the FINXN table: Both the update and delete triggers are "closep_ID = 0"
>>>
>>>So far so good... This yields the behavior I was expecting (almost). If the closep_ID in a Finxn record is NOT 0, any attempt to delete that record or to edit any fields on that record results in a "TRIGGER FAILED" message. That is GREAT! EXCEPT that I am able to modify the closep_ID field and change it from 8 to 0 without failing the trigger. Once I have done that, of course I can then modify all of the other fields.
>>>
>>>I think that is BAD behavior but it gets more interesting... If I change the closep_ID value from 8 to 0, now I cannot change it back to 8!.
>>>
>>>What am I missing ?? Perhaps VFP looks only at the new value of closep_ID and, since it is 0, changes are allowed??
>>>
>>>Thanks,
>>>
>>>Ken
>>
>>Ken,
>>To me what's strange is that you say you can change from 0 to 8. Are you sure you can ?
>>Cetin
>
>Hi Cetin,
>
>Yes, that is the first bad! Absolutely I can change it. Perhaps something to do with buffering wherein VFP looks only at the record in the buffer, sees that it is now 0 ?? But that would not explain the inabililty to change from 0 back to 8.
>
>Thanks,
>
>Ken

But with buffered data triggers wouldn't fire till tableupdate(). Maybe you're misinterpreting the change thinking it has changed ?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform