1273.1.27
by Jay Pipes
Completes the work of removing the weirdness around transaction |
1 |
# Tests a number of things related to transactions: |
2 |
#
|
|
3 |
# 1. Interaction of more than one engine in a transaction |
|
4 |
# 2. Correct commit and rollback behaviour |
|
5 |
# 3. XA protocol communication and recovery |
|
6 |
||
7 |
--disable_warnings
|
|
8 |
DROP TABLE IF EXISTS t1_trx, t1_non_trx; |
|
9 |
--enable_warnings
|
|
10 |
||
11 |
SET AUTOCOMMIT= 0; |
|
12 |
||
13 |
CREATE TABLE t1_trx ( |
|
14 |
k VARCHAR(10) NOT NULL |
|
15 |
, v VARCHAR(10) NOT NULL |
|
16 |
, PRIMARY KEY (k) |
|
17 |
) ENGINE=InnoDB; |
|
18 |
||
19 |
CREATE TEMPORARY TABLE t1_non_trx ( |
|
20 |
k VARCHAR(10) NOT NULL |
|
21 |
, v VARCHAR(10) NOT NULL |
|
22 |
, PRIMARY KEY (k) |
|
23 |
) ENGINE=MyISAM; |
|
24 |
||
25 |
START TRANSACTION; |
|
26 |
||
27 |
INSERT INTO t1_trx VALUES ('key1','value1'); |
|
28 |
INSERT INTO t1_trx VALUES ('key2','value2'); |
|
29 |
||
30 |
INSERT INTO t1_non_trx VALUES ('key1','value1'); |
|
31 |
INSERT INTO t1_non_trx VALUES ('key2','value2'); |
|
32 |
||
33 |
ROLLBACK; |
|
34 |
||
35 |
--echo Expected warning about non-trx data changes not being rolled back
|
|
36 |
||
37 |
SELECT * FROM t1_trx; |
|
38 |
SELECT * FROM t1_non_trx; |
|
39 |
||
40 |
START TRANSACTION; |
|
41 |
||
42 |
INSERT INTO t1_trx VALUES ('key1','value1'); |
|
43 |
INSERT INTO t1_trx VALUES ('key2','value2'); |
|
44 |
||
45 |
SELECT t1_trx.k, t1_trx.v |
|
46 |
FROM t1_trx |
|
47 |
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k; |
|
48 |
||
49 |
ROLLBACK; |
|
50 |
||
51 |
SELECT t1_trx.k, t1_trx.v |
|
52 |
FROM t1_trx |
|
53 |
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k; |
|
54 |
||
1890.2.19
by Stewart Smith
use explicit COMMIT in transaction test instead of implicit commit in DROP TABLE |
55 |
COMMIT; |
1273.1.27
by Jay Pipes
Completes the work of removing the weirdness around transaction |
56 |
DROP TABLE t1_trx; |
57 |
DROP TABLE t1_non_trx; |