Transactions in MySQL

Transactions in MySQL are available only on tables that use the InnoDB or BDB storage engines. See Lesson 14, "Creating and Modifying Tables," for more information on how to select a specific table handler.

To begin a transaction, issue the BEGIN TRANSACTION command. Any database-manipulation statements issued after that command form part of the same transaction.

Until you issue a statement that ends a transaction, the effects of any commands that you enter are visible only within the current MySQL session. For instance, if you delete rows from a table after issuing the START TRANSACTION command, other database users can still query those rows, even though in your session they appear to be already deleted.

To commit all the changes made in a transaction, issue the COMMIT command. Doing so causes each INSERT, UPDATE, and DELETE statement that forms part of the transaction to be executed immediately and as one unit.

Sams Teach Yourself MySQL in 10 Minutes
Sams Teach Yourself MySQL in 10 Minutes
ISBN: 0672328631
EAN: 2147483647
Year: 2006
Pages: 165
Authors: Chris Newman

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: