If the connection is disconnected before reaching COMMIT
, an automatic ROLLBACK
occurs.
Documentation :
With START TRANSACTION, autocommit remains disabled until you end the transaction with COMMIT or ROLLBACK. The autocommit mode then reverts to its previous state.
After disabling autocommit mode by setting the autocommit variable to zero, changes to transaction-safe tables (such as those for InnoDB or NDB) are not made permanent immediately. You must use COMMIT to store your changes to disk or ROLLBACK to ignore the changes.
Basically, when you start a transaction the autocommit
flag is turned off. While it remains off, the changes are not persisted until a COMMIT
is executed. If the link goes down, the changes have never been persisted - and therefore have no effect.