~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/suite/sys_vars/r/completion_type_func.result

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
DROP TABLE IF EXISTS t1;
 
2
## Creating new table ##
 
3
CREATE TABLE t1
 
4
(
 
5
id INT NOT NULL,
 
6
PRIMARY KEY (id),
 
7
name VARCHAR(30)
 
8
) ENGINE = INNODB;
 
9
## Creating new connections test_con1, test_con2 ##
 
10
#########################################################
 
11
#    Setting initial value of completion_type to zero   #
 
12
#########################################################
 
13
INSERT INTO t1 VALUES(1,'Record_1');
 
14
SELECT * FROM t1;
 
15
id      name
 
16
1       Record_1
 
17
## Setting value of variable to 0 ##
 
18
SET @@session.completion_type = 0;
 
19
## Here commit & rollback should work normally ##
 
20
## test commit ##
 
21
START TRANSACTION;
 
22
INSERT INTO t1 VALUES(2,'Record_2');
 
23
INSERT INTO t1 VALUES(3,'Record_3');
 
24
SELECT * FROM t1;
 
25
id      name
 
26
1       Record_1
 
27
2       Record_2
 
28
3       Record_3
 
29
Switching to connection test_con1
 
30
## Don't expect to see id's 2 and 3 in the table w/o COMMIT ##
 
31
SELECT * FROM t1;
 
32
id      name
 
33
1       Record_1
 
34
Switching to default connection
 
35
COMMIT;
 
36
## test rollback ##
 
37
START TRANSACTION;
 
38
INSERT INTO t1 VALUES(4,'Record_4');
 
39
INSERT INTO t1 VALUES(5,'Record_5');
 
40
SELECT * FROM t1;
 
41
id      name
 
42
1       Record_1
 
43
2       Record_2
 
44
3       Record_3
 
45
4       Record_4
 
46
5       Record_5
 
47
Switching to connection test_con1
 
48
## Don't expect to see id's 4 and 5 here ##
 
49
## Expect to see 3, Record_3 ##
 
50
SELECT * FROM t1;
 
51
id      name
 
52
1       Record_1
 
53
2       Record_2
 
54
3       Record_3
 
55
Switching to connection default;
 
56
ROLLBACK;
 
57
## Don't expect to see id's 4 and 5 now ##
 
58
SELECT * FROM t1;
 
59
id      name
 
60
1       Record_1
 
61
2       Record_2
 
62
3       Record_3
 
63
 
 
64
#########################################################
 
65
#    Setting initial value of completion_type to one    #
 
66
#########################################################
 
67
Switching to connection test_con1;
 
68
SET @@session.completion_type = 1;
 
69
START TRANSACTION;
 
70
SELECT * FROM t1;
 
71
id      name
 
72
1       Record_1
 
73
2       Record_2
 
74
3       Record_3
 
75
INSERT INTO t1 VALUES(6,'Record_6');
 
76
INSERT INTO t1 VALUES(7,'Record_7');
 
77
COMMIT;
 
78
## Expect to immediately have a new transaction ##
 
79
INSERT INTO t1 VALUES(8,'Record_8');
 
80
SELECT * FROM t1;
 
81
id      name
 
82
1       Record_1
 
83
2       Record_2
 
84
3       Record_3
 
85
6       Record_6
 
86
7       Record_7
 
87
8       Record_8
 
88
switching to test_con2
 
89
## Do not expect to see 8, Record_8 as no COMMIT has occurred ##
 
90
SELECT * FROM t1;
 
91
id      name
 
92
1       Record_1
 
93
2       Record_2
 
94
3       Record_3
 
95
6       Record_6
 
96
7       Record_7
 
97
switch to connection test_con1
 
98
## Testing ROLLBACK behavior
 
99
START TRANSACTION;
 
100
INSERT INTO t1 VALUES(9, 'Record_9');
 
101
INSERT INTO t1 VALUES(10, 'Record_10');
 
102
## Expect to see id's 8, 9, 10 here ##
 
103
## 8, Record_8 COMMITted with the start of this transaction ##
 
104
SELECT * FROM t1;
 
105
id      name
 
106
1       Record_1
 
107
2       Record_2
 
108
3       Record_3
 
109
6       Record_6
 
110
7       Record_7
 
111
8       Record_8
 
112
9       Record_9
 
113
10      Record_10
 
114
ROLLBACK;
 
115
## id's 9 and 10 are gone now due to ROLLBACK ##
 
116
SELECT * FROM t1;
 
117
id      name
 
118
1       Record_1
 
119
2       Record_2
 
120
3       Record_3
 
121
6       Record_6
 
122
7       Record_7
 
123
8       Record_8
 
124
## Expect a new transaction ##
 
125
INSERT INTO t1 VALUES(9, 'Record_9');
 
126
Switching to connection test_con2
 
127
## Don't expect to see 9, Record_9 due to no COMMIT yet ##
 
128
SELECT * FROM t1;
 
129
id      name
 
130
1       Record_1
 
131
2       Record_2
 
132
3       Record_3
 
133
6       Record_6
 
134
7       Record_7
 
135
8       Record_8
 
136
Switching to connection test_con1
 
137
ROLLBACK;
 
138
## Don't expect to see 9, Record_9
 
139
SELECT * FROM t1;
 
140
id      name
 
141
1       Record_1
 
142
2       Record_2
 
143
3       Record_3
 
144
6       Record_6
 
145
7       Record_7
 
146
8       Record_8
 
147
#########################################################
 
148
#    Setting initial value of completion_type to 2      #
 
149
#########################################################
 
150
SET @@session.completion_type = 2;
 
151
## Here commit should work as COMMIT RELEASE ##
 
152
START TRANSACTION;
 
153
SELECT * FROM t1;
 
154
id      name
 
155
1       Record_1
 
156
2       Record_2
 
157
3       Record_3
 
158
6       Record_6
 
159
7       Record_7
 
160
8       Record_8
 
161
INSERT INTO t1 VALUES(9,'Record_9');
 
162
INSERT INTO t1 VALUES(10,'Record_10');
 
163
COMMIT;
 
164
## Inserting rows should give error here because connection should ##
 
165
## disconnect after using COMMIT ##
 
166
INSERT INTO t1 VALUES(4,'Record_4');
 
167
Got one of the listed errors
 
168
switch to connection test_con2
 
169
SET @@session.completion_type = 2;
 
170
## Inserting rows and using Rollback which should Rollback & release ##
 
171
START TRANSACTION;
 
172
SELECT * FROM t1;
 
173
id      name
 
174
1       Record_1
 
175
2       Record_2
 
176
3       Record_3
 
177
6       Record_6
 
178
7       Record_7
 
179
8       Record_8
 
180
9       Record_9
 
181
10      Record_10
 
182
INSERT INTO t1 VALUES(11,'Record_11');
 
183
INSERT INTO t1 VALUES(12,'Record_12');
 
184
ROLLBACK;
 
185
## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ##
 
186
INSERT INTO t1 VALUES(4,'Record_4');
 
187
Got one of the listed errors
 
188
DROP TABLE t1;