auto commit
This commit is contained in:
parent
50fab322bb
commit
47612fa00b
|
@ -42,13 +42,13 @@
|
|||
|
||||
## 概念
|
||||
|
||||
<div align="center"> <img src="../pics//4f4deaf4-8487-4de2-9d62-5ad017ee9589.png"/> </div><br>
|
||||
<div align="center"> <img src="../pics//185b9c49-4c13-4241-a848-fbff85c03a64.png"/> </div><br>
|
||||
|
||||
事务指的是满足 ACID 特性的一系列操作。在数据库中,可以通过 Commit 提交一个事务,也可以使用 Rollback 进行回滚。
|
||||
|
||||
## 四大特性
|
||||
|
||||
<div align="center"> <img src="../pics//fd945daf-4a6c-4f20-b9c2-5390f5955ce5.jpg" width="500"/> </div><br>
|
||||
<div align="center"> <img src="../pics//4fc032e0-ac6f-4b42-9182-ee104a25e7a1.png"/> </div><br>
|
||||
|
||||
### 1. 原子性(Atomicity)
|
||||
|
||||
|
@ -76,23 +76,25 @@
|
|||
|
||||
T<sub>1</sub> 和 T<sub>2</sub> 两个事务都对一个数据进行修改,T<sub>1</sub> 先修改,T<sub>2</sub> 随后修改,T<sub>2</sub> 的修改覆盖了 T<sub>1</sub> 的修改。
|
||||
|
||||
<div align="center"> <img src="../pics//a57a6fc8-c5e9-456c-80ff-a5139dda4b6e.png"/> </div><br>
|
||||
|
||||
### 2. 读脏数据
|
||||
|
||||
T<sub>1</sub> 修改一个数据,T<sub>2</sub> 随后读取这个数据。如果 T<sub>1</sub> 撤销了这次修改,那么 T<sub>2</sub> 读取的数据是脏数据。
|
||||
|
||||
<div align="center"> <img src="../pics//d1ab24fa-1a25-4804-aa91-513df55cbaa6.jpg" width="800"/> </div><br>
|
||||
<div align="center"> <img src="../pics//dd782132-d830-4c55-9884-cfac0a541b8e.png"/> </div><br>
|
||||
|
||||
### 3. 不可重复读
|
||||
|
||||
T<sub>2</sub> 读取一个数据,T<sub>1</sub> 对该数据做了修改。如果 T<sub>2</sub> 再次读取这个数据,此时读取的结果和和第一次读取的结果不同。
|
||||
|
||||
<div align="center"> <img src="../pics//d0175e0c-859e-4991-b263-8378e52f7ee5.jpg" width="800"/> </div><br>
|
||||
<div align="center"> <img src="../pics//c8d18ca9-0b09-441a-9a0c-fb063630d708.png"/> </div><br>
|
||||
|
||||
### 4. 幻影读
|
||||
|
||||
T<sub>1</sub> 读取某个范围的数据,T<sub>2</sub> 在这个范围内插入新的数据,T<sub>1</sub> 再次读取这个范围的数据,此时读取的结果和和第一次读取的结果不同。
|
||||
|
||||
<div align="center"> <img src="../pics//d589eca6-c7cf-49c5-ac96-8e4ca0cccadd.jpg" width="800"/> </div><br>
|
||||
<div align="center"> <img src="../pics//688dacfe-1057-412f-b3a1-86abb5b0f914.png"/> </div><br>
|
||||
|
||||
## 解决方法
|
||||
|
||||
|
|
BIN
pics/185b9c49-4c13-4241-a848-fbff85c03a64.png
Normal file
BIN
pics/185b9c49-4c13-4241-a848-fbff85c03a64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
pics/4fc032e0-ac6f-4b42-9182-ee104a25e7a1.png
Normal file
BIN
pics/4fc032e0-ac6f-4b42-9182-ee104a25e7a1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
pics/688dacfe-1057-412f-b3a1-86abb5b0f914.png
Normal file
BIN
pics/688dacfe-1057-412f-b3a1-86abb5b0f914.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
pics/a57a6fc8-c5e9-456c-80ff-a5139dda4b6e.png
Normal file
BIN
pics/a57a6fc8-c5e9-456c-80ff-a5139dda4b6e.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
pics/c8d18ca9-0b09-441a-9a0c-fb063630d708.png
Normal file
BIN
pics/c8d18ca9-0b09-441a-9a0c-fb063630d708.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
pics/dd782132-d830-4c55-9884-cfac0a541b8e.png
Normal file
BIN
pics/dd782132-d830-4c55-9884-cfac0a541b8e.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue
Block a user