>Hello People
>
>I have a big problem.
>A simpler description of the problem is as follows.
>
>I have a table which is buffered via optimistic table buffering.
>
>Now I have a record modified but not yet commited
>I re modify the record but want to undo the changes to reflect the previous state of the record ...
>
>
>* eg
>
>* Name : Hiten
>* Name : HKM
>* Name : Abcd
>* Undo
>* Name : HKM
>
>* Table Update is not done during the above processing
>* Table revert is used to undo but then i get back to "Hiten" and not "HKM"
>* Which is what I dont want to happen
>* I also dont want to use transactions.
>
>
>any sugestions on how to do it ?
>
>Thanx.
Hiten,
If you know the time you start another modification then you could scatter current state to an object and gather later. ie:
Define class myModifier as Relation
Dimension arrModObj[1]
Procedure StartModify
With this
Dimension .arrModObj[iif(type('.arrModObj')='L',1,alen(.arrModObj)+1)]
Scatter name .arrModObj[alen(.arrModObj)]
Endwith
Endproc
Procedure RevertModify
Lparameters tlAll
With this
If type('.arrModObj')='L'
Return && No modification
Endif
If tlAll
Gather name .arrModObj[1]
Dimension .arrModObj[1]
.arrModObj = .F.
Else
Gather name .arrModObj[alen(.arrModObj)]
Dimension .arrModObj[alen(.arrModObj)-1]
Endif
Endwith
EnddefineNotice this is a simplified version that doesn't track recno() nor a redo option.
You could do that table wise with getnextmodified(). Also if table is small enough you could just copy to array whole table and get back too.
Honestly though I would use transactions or snapshot cursors (not SQL select-create cursor, do while getnextmodifed(),insert) if txnlevel() would be high.
Cetin