Navigation:  Programming Cookbook > Database Connectivity > Transactions >


Previous pageReturn to chapter overviewNext page

Sometimes you may come across a situation where you don't want to commit the operations that have so far been performed as part of a transaction. In such cases you can use #rollbackTxn to avoid the changes being written to the database. In the following example we delete all records from the Orders table and then change our minds before the damage is done:

c beginRWTxn.

c exec: 'update Suppliers set CompanyName=''Object Arts Ltd'' where SupplierID=2'.

c rollbackTxn.


Again, you may wish to confirm that the rollback has been successful:

c query: 'select * from Suppliers where SupplierID=2. "Inspect it"