~drizzle-trunk/drizzle/development

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
47
48
49
50
51
52
53
54
55
56
# Tests a number of things related to transactions:
# 
# 1. Interaction of more than one engine in a transaction
# 2. Correct commit and rollback behaviour
# 3. XA protocol communication and recovery

--disable_warnings
DROP TABLE IF EXISTS t1_trx, t1_non_trx;
--enable_warnings

SET AUTOCOMMIT= 0;

CREATE TABLE t1_trx (
  k VARCHAR(10) NOT NULL
, v VARCHAR(10) NOT NULL
, PRIMARY KEY (k)
) ENGINE=InnoDB;

CREATE TEMPORARY TABLE t1_non_trx (
  k VARCHAR(10) NOT NULL
, v VARCHAR(10) NOT NULL
, PRIMARY KEY (k)
) ENGINE=MyISAM;

START TRANSACTION;

INSERT INTO t1_trx VALUES ('key1','value1');
INSERT INTO t1_trx VALUES ('key2','value2');

INSERT INTO t1_non_trx VALUES ('key1','value1');
INSERT INTO t1_non_trx VALUES ('key2','value2');

ROLLBACK;

--echo Expected warning about non-trx data changes not being rolled back

SELECT * FROM t1_trx;
SELECT * FROM t1_non_trx;

START TRANSACTION;

INSERT INTO t1_trx VALUES ('key1','value1');
INSERT INTO t1_trx VALUES ('key2','value2');

SELECT t1_trx.k, t1_trx.v
FROM t1_trx
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;

ROLLBACK;

SELECT t1_trx.k, t1_trx.v
FROM t1_trx
INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;

DROP TABLE t1_trx;
DROP TABLE t1_non_trx;