~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/savepoints.test

  • Committer: Brian Aker
  • Date: 2010-04-22 23:44:51 UTC
  • mfrom: (1491.2.3 bug542299)
  • Revision ID: brian@gaz-20100422234451-bvypspmrcdz46h6d
Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# Test for Bug #534806 - SAVEPOINT without active transaction
4
4
# triggers assert in InnoDB handler
5
5
 
 
6
--echo Start Test of Bug 534806
 
7
 
6
8
SET AUTOCOMMIT = 0;
7
9
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
8
10
COMMIT;
9
11
UPDATE t1 SET id = 2 WHERE id != 2 LIMIT 0;
10
12
SAVEPOINT A;
11
13
 
 
14
--echo End Test of Bug 534806
 
15
 
12
16
DROP TABLE t1;
13
17
 
14
18
# Let's test the non-edge case for SAVEPOINTS:
18
22
# and committing without any rollbacks or savepoint releases.
19
23
 
20
24
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
21
 
 
22
25
START TRANSACTION;
23
 
 
24
26
INSERT INTO t1 VALUES (1);
25
 
 
26
27
SAVEPOINT A;
27
 
 
28
28
INSERT INTO t1 VALUES (2);
29
 
 
30
29
SAVEPOINT B;
31
 
 
32
30
INSERT INTO t1 VALUES (3);
33
 
 
34
31
COMMIT;
35
32
 
36
33
# t1 should now have 1,2,3 in it.
41
38
# work done in all savepoints should be rolled back.
42
39
 
43
40
START TRANSACTION;
44
 
 
45
41
INSERT INTO t1 VALUES (4);
46
 
 
47
42
SAVEPOINT A;
48
 
 
49
43
INSERT INTO t1 VALUES (5);
50
 
 
51
44
SAVEPOINT B;
52
 
 
53
45
INSERT INTO t1 VALUES (6);
54
 
 
55
46
ROLLBACK;
56
47
 
57
48
# t1 should still have 1,2,3 in it.
61
52
# ROLLBACK work to a specific SAVEPOINT and then COMMIT.
62
53
 
63
54
START TRANSACTION;
64
 
 
65
55
INSERT INTO t1 VALUES (4);
66
 
 
67
56
SAVEPOINT A;
68
 
 
69
57
INSERT INTO t1 VALUES (5);
70
 
 
71
58
SAVEPOINT B;
72
 
 
73
59
INSERT INTO t1 VALUES (6);
74
 
 
75
60
ROLLBACK TO SAVEPOINT A;
76
 
 
77
61
COMMIT;
78
62
 
79
63
# t1 should have 1,2,3,4 in it.
80
64
SELECT * FROM t1;
81
 
 
82
65
DROP TABLE t1;
 
66
 
 
67
 
68
# Test for Bug #542299
 
69
#
 
70
# segfault on ROLLBACK TO SAVEPOINT A - during randgen
 
71
#
 
72
--echo Start Test of Bug 542299
 
73
 
 
74
CREATE TABLE t1 (a int,id integer auto_increment,b int,/*Indices*/key (a ),primary key (id)) ENGINE=innodb;
 
75
INSERT INTO t1 VALUES  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100) ,  (100, NULL, 100);
 
76
SET AUTOCOMMIT=OFF;
 
77
DELETE FROM t1 WHERE 1 = 1 LIMIT 1;
 
78
COMMIT; /* OR ROLLBACK... */
 
79
SAVEPOINT A;
 
80
INSERT INTO t1 ( a, b ) VALUES ( 1 , 9 );
 
81
ROLLBACK TO SAVEPOINT A;
 
82
 
 
83
--echo End Test of Bug 542299