Transaction
Overview
Transactions provide your queries with an "all or nothing" approach to data modifications. In the event that there is an error, the transaction will be rolled back to return the database to the pre-transaction state.
Example
BEGIN TRANSACTION
DELETE FROM WordList:Word WHERE Text = 'Cat'
DELETE FROM WordList:Word WHERE Text = 'Catboat'
DELETE FROM WordList:Word WHERE Text = 'Catfish'
ROLLBACK TRANSACTION
After the rollback, the database will be in the same state as it was before the transaction began. If we had wanted to keep these changes, we would have called COMMIT TRANSACTION.
Related
- Keywords - A breakdown of all high-level statements available via the query handler.