Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transactions
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00490206
Message ID:
00490217
Vues:
11
>I have an application in which I'm updating several tables and want to wrap then in a tranaction so that if one update fails I can rollback any changes. However when I first wrote the code I did all my updating to each of the tables before I started the Begin Transaction End Transaction and now realize that the rollback will only rollback any transactions within the Begin End Transaction. So instead I have changed the code so that if the tableupdate fails on any of the tables I just do a tablerevert for each of the tables. I have also read that you need to keep to a miniumum what you do within the transaction because it locks the table. What can we consider a reasonible amount of code to put within a transaction. Will I be ok if I leave my code as is with the tablerevert if the tableupdate fails.

The problem is, if the first 4 work and number 5 fails, you cannot tablerevert something that has been tableupdated. That is what the transaction is for. The best way to do this, is to have buffering on, make your changes, start the transaction and then do all your tableupdates. If any of them fail, do your rollback and then tablerevert all of them.
Cy Welch
Senior Programmer/Analyst
MetSYS Inc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform