~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/savepoints.test

  • Committer: Monty Taylor
  • Date: 2010-03-23 08:23:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1398.
  • Revision ID: mordred@inaugust.com-20100323082332-r8tktlbu82wlamzv
Set the default plugin version for plugins not specifying a version to be
tied to the actual server version.

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