Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleted Records in Buffers

Status
Not open for further replies.

fruityBoy

Programmer
Jul 21, 2000
51
GB
Hi, I'm using table buffering on a fox table. If, in the buffer, I insert a record, then delete this record and then do a tableupdate(), the deleted record is inserted into the database.

This is fine and what I would expect. However, I have a stored procedure tied to a DELETE trigger for the table in question, which does not fire in this circumstance. I was wondering if their is some setting which would allow the delete trigger to fire even in a buffered environment?

Thanks in advance.
 
Hi!

It is not a good idea to delete just inserted record without the updating table. Usually when user deleter just inserted record, he/she do not want thsi record stored into the database.

Change the logic of your program so when user delete some record that is just inserted, it is just tablereverted for that single record. In the deleting code you can check f record is inserted by using GETFLDSTATE(-1) function. When new record inserted, this function return a string with all "3" and "4". For example:

chrtan(getfldstate(-1),"34","")=="" is .T. in case record is new.

Hope this helps... Vlad Grynchyshyn, MVP
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi

Yeah, the system demands that deleted records in the buffer are inserted into the database so that the user's actions in all circumstances can be traced (i.e., we want to know if he / she is inserting lots of records and then deleting them before a table update).

The information can be deleted from different sources, therefore this trap needs to be on the trigger. I thought of changing the insert trigger, so if a record is inserted that is flagged as deleted, I could record this.

I just thought that there may be a SET statement that allowed delete triggers on buffered records..


 
I guess no. This is because "deleted()" mark is really a separate field in the table (physically). So when you do a tableupdate() for new record, that field is marked as in 3d or 4th state in GetFldState() for deleted(). his means inserting, and as a result, VFP will call only inserting trigger. So probably a solution with inserting trigger code for such records is a good idea. Vlad Grynchyshyn, MVP
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
That follows, yeah, thanks for your help, I'll write an insert trigger and see if it works (I'll post to this thread and let you know if it does).

Thanks Again

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top