SQLite Transactions
Overview
Let’s learn about SQLite transactions in this tutorial. So far, we have interactively executed several SQLite statements that perform various actions on the database. The statements were run in an isolated environment, one at a time, with no concurrency or contention for data access with other users.
SQLite Transactions
An SQLite transaction is a set of one or more SQL statements that perform a set of related actions. The statements are grouped together and treated as a single unit of work against the database, whose success or failure depends on the successful execution of each statement in the transaction.
Transactions should adhere to or pass the ACID test. ACID stands for:
- Atomic
- Consistency
- Isolation
- Durability
Atomic
The statements in a transaction are treated as a single unit of work. Either all the designated database operations are performed, or none are performed.
A successful transaction is when all the database operations are performed successfully, and the results are applied to the database.
Consistency
Each transaction must leave the database consistently at the end of the transaction. The database may be inconsistent if only some statements are executed and others fail.
Isolation
A transaction must be isolated from others and not be affected by them. Transactions should operate independently and be transparent to other transactions.
Durability
Once any changes resulting from a transaction are committed to the database, those changes must be preserved permanently despite any errors or system failures.
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: