一、事务及事务的特性
数据库事务(Database Transaction) ,是指作为单个逻辑工作单元执行的一系列操作。 一个逻辑工作单元要成为事务,必须满足所谓的ACID(原子性、一致性、隔离性和持久性)属性。
原子性(atomicity) [all or nothing]
事务必须是原子工作单元;对于其数据修改,要么全都执行,要么全都不执行。
一致性(consistency) [from one consistent state to the next consistent state]
事务结束时,所有的内部数据结构与事务开始前必须是一致的。
隔离性(isolation) [different operations cannot access modified data from another transaction that has not yet completed]
由并发事务所作的修改必须与任何其它并发事务所作的修改隔离。事务不能查看其他事务正在执行时(中间状态)的数据。
持久性(durability) [persistently stored]
事务完成之后,它对于系统的影响是永久性的。