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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Failure

Status
Not open for further replies.

ongoma

Programmer
Jun 14, 2006
31
0
0
KE

How r you brethren?

I have reported this before but I hope you will bear with me. I seem to have a problem with updates to tables. I am buffering them
then
do my changes
then
run a program which saves the changes for all tables with a "dirty buffer".

So far everything is okay (Triggers fire fine, conflicts are resolved well and fieldlevel validations respond well)

This devil called index corruption somehow manages to corrupt indexes (power problems) in such a way that though my "saving program" will report "Update Success" actually on some tables (heavy ones) the records go missing (courtesy of index corruption). No error is generated whatsoever concerning Indexes not matching table.. and so on

To circumvent this problem I have made my saving program (it's one for the whole app) to log mannualy ALL UPDATES (Inserts,deletes and edits) into some transaction log files (textfiles) with names corresponding to the said table names. irregardless of all possible problems these "saving program" is able to write successfully to these textfiles all updates even if it fails to do it on the tables.

So the user calls and says:

"I made a sale at the POS i printed the receipt but the sale is not on the sales report neither can I reprint the receipt, it's not there"

Solution: "Run the routine to restore lost data"
it works and works very well.

My question: Was this lengthy approach warranted? Or there is away I can detect in the program that though TableUpdate() reported success the records in the buffer never actually went to the base tables?

Please help! Thanks in advance

 
Ongoma,

One possibility would be to write the contents of the record to a set of memory variables just before you call TableUpdate() (use SCATTER MEMVAR for this). Then, after the TableUpdate(), compare the current contents of the record with the memory variables. But it's not completely reliable, since another user might have updated the same record in the short interval since you saved it.

My preferred approach would be to find what was causing the corruption in the first place, and to get rid of it.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

Thanks for that piece of advice. I feel it should work since I only have one program which saves chnges to tables

I am hoping the power problem will be sorted out. Then the problem will go somehow.

But just incase the problem is not power... made me look for a lasting solution. ALL or NOTHING is saved with TableUpdate() RETURNING correct update status.

However I will incorporate that solution in the saving program. I think it's easier that way. For all tables being updated I will have some Cursors which will store all changes then After TableUpdate() I can run a small routine that will check whether actually those changes went to the base tables. The user can then be given the appropriate message. I can then manually force the changes without buffering. Something like that.

Any more advice will be welcome

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top