Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do program transaction within transaction
Message
De
11/06/2010 08:53:37
 
 
À
07/06/2010 18:55:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01467775
Message ID:
01468493
Vues:
49
>>>>Alejandro,
>>>>
>>>>No, it doesn't make sense to open a new transaction upon entering a form if this form allows user's input. Transactions should be as short as possible,
>>>
>>>What is the best approach?
>>>
>>>1) In form 1, user chooses to modify monday's data and enters form2.
>>>2) In form2 user makes changes and exits by choosing OK, not cancel.
>>>3) He is back to form 1 and the buffered tables contain the changes made.in step 2
>>>4) Now he choses to modify tuesday's data and again enters form2
>>>5) In form2 he makes changes which are stored in the same buffered tables as previous data, perhaps overwriting some of the changes made in step 2. This time he chooses to exit by canceling the changes he just made. Fields need to be restored to the values established in step 2, not to the original values before step 1.
>>>
>>>The recommendation you gave me, that transactions should be brief to minimize conflict with other users, makes sense. But other than manually saving the values as we did in FoxPro DOS the only way I can imagine to accomplish what we need is to start a transaction when entering form2.
>>>
>>>What is the best approach? Should I bite the bullet and manually save the data?
>>>
>>>Thank you very much,
>>>
>>>Alex
>>
>>One possibility would be to have a collection of saved records (individual record saved with scatter name loRecord and then it's added to collection). This is one possibility I see for this problem.
>
>Does anyone else have another suggestion?

Hi Alejandro

My aproach is to always keep everything buffered (5) and always save or cancell all changes to all tables at once.

To handle situation you are describing, I would simply save all at step 2 (user confirmed) , then let him go to to second form
(step 4) which now reflects already changes made in step 2 and again depend on his choice save or revert all.

If he chooses to cancel stp 4 changes he still keeps changes done in step 2.

There should be no changes alowed except those that happen between

start writing point (run second form)
user makes changes
end writing point (decision save / cancel)

central saving procedure (save all / revert all)

Then repeat these steps over over again.
No data changes should be alowed unless thy can be wrapped inside one of these cycles.

I do not know if this is possible with codemine framework since back in early days of OOP everybody was frawning at usage
of modal forms whereas this is one of situations where modal form can make life much much easier.

HTH
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform