1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
SET AUTOCOMMIT = 0;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
COMMIT;
UPDATE t1 SET id = 2 WHERE id != 2 LIMIT 0;
SAVEPOINT A;
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SAVEPOINT A;
INSERT INTO t1 VALUES (2);
SAVEPOINT B;
INSERT INTO t1 VALUES (3);
COMMIT;
SELECT * FROM t1;
id
1
2
3
START TRANSACTION;
INSERT INTO t1 VALUES (4);
SAVEPOINT A;
INSERT INTO t1 VALUES (5);
SAVEPOINT B;
INSERT INTO t1 VALUES (6);
ROLLBACK;
SELECT * FROM t1;
id
1
2
3
START TRANSACTION;
INSERT INTO t1 VALUES (4);
SAVEPOINT A;
INSERT INTO t1 VALUES (5);
SAVEPOINT B;
INSERT INTO t1 VALUES (6);
ROLLBACK TO SAVEPOINT A;
COMMIT;
SELECT * FROM t1;
id
1
2
3
4
DROP TABLE t1;
|