A What is a transaction
A transaction is a rigorous set of operations in an application, and all operations must be completed successfully, or all changes made in each operation will be undone. That is, transactions are atomic, and a series of operations in a transaction are either successful or not.
The end of a transaction has two types, and when all the steps in the transaction are executed successfully, the transaction commits. If one of the steps fails, a rollback operation occurs, and the undo action is undone until the start of the transaction.
Two ACID of the transaction
A transaction has four characteristics: atomicity (atomicity), consistency (consistency), isolation (isolation), and persistence (durability). These four properties are referred to as ACID properties.
1. Atomic Nature
A transaction is a logical unit of work for a database, and each operation contained in a transaction is either done or not
2. Consistency
The result of the transaction execution must be to change the database from one consistent state to another. Therefore, when the database contains only the results of successful transaction commits, the database is said to be in a consistent state. If a database system fails in operation and some transactions have not yet been completed, some of the modifications made to the database have been written to the physical database, and the database is in an incorrect state, or an inconsistent state.
3, the isolation of
Execution of one transaction cannot interfere with other transactions. That is, the operations within one transaction and the data used are isolated from other concurrent transactions, and the transactions performed concurrently cannot interfere with each other.
4, the continuity of
Also known as permanence, when a transaction is committed, its changes to the data in the database should be permanent. The next operation or failure should not have any effect on its execution results.
The database system must maintain the following characteristics of the transaction (for short, ACID):
Atomicity (atomicity)
Consistency (consistency)
Isolation (Isolation)
Persistence (Durability)
Atomicity (atomicity)
All operations in a transaction are either fully executed or not executed;
If the transaction does not have an atomic guarantee, then the system
In the event of a failure, the database may be in an inconsistent
State.
android--transactions