Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tablerevert() vs. Rollback
Message
From
15/12/1998 12:19:37
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00167645
Message ID:
00167756
Views:
23
FWIW, this is how I understand their relationship.
BEGIN TRANSACTION 
*!* Says you're going to write buffers of several related tables

  *!* write the buffer for one of these related tables
  IF TABLEUPDATE() 
      *!* Then write the other buffers (checking each time), and if it's ok
    END TRANSACTION
  ELSE 
    *!* Else I couldn't write ALL the buffers so I want to...
    ROLLBACK  
    *!* undo all the writes that I did.  This changes the <b>writing</b> of 
    *!* the buffer, but <b>not</b> the buffer itself.  Which can be a good
    *!* thing.
    TABLEREVERT() && Each buffer 
    *!* OR
    *!* You can give the user the opportunity to change whatever went 
    *!* wrong in the transaction, so they don't have to keep redoing their
    *!* work and guessing if it's right.
If you are only updating one table, or several tables that are independent of one another then you do not need a BEGIN TRANSACTION. Transactions are only needed when one table's update depends on another's being able to be updated too.

You probably have read that you want to keep the transaction to the minimum amount of time, because files are locked when you are in one.

So, in short, it easy to think that ROLLBACK and TABLEREVERT() are the same, but they aren't, really.

HTH.

>Hello All,
>We begin a transaction, edit the record, select out next commmand
>button, receive a message, "Do you wish to save changes". We
>select "no" , issue the ROLLBACK command and go to the next record. We come back by selecting the previous command button and the change we tries to negate shows up on the record. We leave the application, come back to the same record jand it is with the original data.
>
>Note we are also buffering optimistically (5)
>SO, obviously, the data is being changed in the buffer but not be writen to the disk.
>
>How do we clean up the buffer??
>
>Thanks,
>
>Sandy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform