These statements provide control over use of transactions:
START
TRANSACTION or BEGIN
›
start a new transaction.
COMMIT
›
commits the current transaction, making its
changes permanent
ROLLBACK
›
rolls back the current transaction, canceling
its changes
SET
autocommit
›
disables or enables the default autocommit
mode for the current session
CREATE TABLE t (f INT) TYPE=InnoDB;
BEGIN;
INSERT INTO t(f) VALUES (1);
SELECT * FROM t;
ROLLBACK;
SELECT * FROM t;
CREATE TABLE t (f INT) TYPE=InnoDB;
BEGIN;
INSERT INTO t(f) VALUES (1);
SELECT * FROM t;
COMMIT;
ROLLBACK;
SELECT
* FROM t;
No comments:
Post a Comment