Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Buffering and the Update Trigger
Message
From
04/02/2003 16:20:28
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Table Buffering and the Update Trigger
Miscellaneous
Thread ID:
00749080
Message ID:
00749080
Views:
54
I have implemented an audit log on one of my tables as an experiment, by adding an Update trigger for that table in the DBC. I am using buffering mode 5 (Table buffering, not row)

DBC procedure code :
FUNCTION updAcctNumTrigger
INSERT INTO acctnumlog (wcode,st,cnty,unit,acct,timestmp);
	VALUES (acctnum.wcode,acctnum.st,acctnum.cnty,acctnum.unit,acctnum.acct,DATETIME())
RETURN .T. 
ENDFUNC 
The trigger just has a call to this function in it. This works, in a manner of speaking.

The main data entry form that saves in this table has this relevant line:
lAcctsaved=Tableupdate(2,.T.,"acctnum")
Upon update, records are inserted into this log. However, it is also inserting records that did not have a change made to them. They should not be 'dirty' in the buffer. I get logged records in this table every time somone saves in this form, regardless of whether they made any edits to the target table.

I am wondering if it is because I have 'force' set to .T. in the TABLEUPDATE() call. This particular table is a child in a one-to-many relationship in this form. (among multiple children).

What I'd like to achieve, is to get a record each time an actual change is made to the data. Buffering may not always be in effect, since changes to this table may happen in various ways besides this one form. (This is why I want thr trigger, to capture them no matter how thet happen.)

Advice, ideas, curses and cheers are all invited <g>,

thanks
Jim Newsom
IT Director, ICG Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform