Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Buffering and multiple tablereverts...
Message
De
07/04/2001 11:11:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00493181
Message ID:
00493214
Vues:
14
>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  && Orignal value
>* Name   : HKM    && Modified Value 1
>* Name   : Abcd   && Modified Value 2
>* Undo
>* Name   : HKM    && Value after undo.
>
>* 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
Ç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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform