|
|
|
|
| |
Performing Transactions
A transaction is a set of SQL statements that are executed as a unit without interruption. One use for transactions is to make sure that the records involved in an operation are not modified by other clients while you're working with them. MySQL automatically performs locking for single SQL statements to keep clients from interfering with each other. (For example, two clients cannot update the same record in a table simultaneously.) But automatic single-statement locking is not always sufficient to guarantee that a database operation achieves its intended result, because some operations are performed over the course of several statements. In this case, different operations may interfere with each other. A transaction groups statements into a single execution unit to prevent concurrency problems that might otherwise occur in a multiple-client environment.
Transaction support also includes commit and rollback capabilities, which allows you to require that the statements must execute as a unit or not at all. That is, if the transaction succeeds, you know that all the statements within it executed successfully. If any part of the transaction fails, any statements executed up to that point within it are undone, leaving the database in the state it was in prior to the point at which the transaction began.
Transactional systems typically are characterized as providing ACID properties. ACID is an acronym for Atomic, Consistent, Isolated, and Durable, referring to four properties that transactions should have:
Atomicity. The statements a transaction consists of form a logical unit. You can't have just some of them execute.
Consistency. The database is consistent before and after the transaction executes. In other words, the transaction doesn't make a mess of your database.
Isolation. One transaction has no effect on another.
Durability. When a transaction executes successfully to completion, its effects are recorded permanently in the database.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|