Debian Codegraph @

mysql-test/suite/ndb/r/ndb_transaction.result

raw
1 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
2 drop database if exists mysqltest;
3 CREATE TABLE t1 (
4 pk1 INT NOT NULL PRIMARY KEY,
5 attr1 INT NOT NULL
6 ) ENGINE=ndbcluster;
7 begin;
8 insert into t1 values(1,1);
9 insert into t1 values(2,2);
10 select count(*) from t1;
11 count(*)
12 2
13 select * from t1 where pk1 = 1;
14 pk1 attr1
15 1 1
16 select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
17 attr1
18 2
19 rollback;
20 select count(*) from t1;
21 count(*)
22 0
23 select * from t1 where pk1 = 1;
24 pk1 attr1
25 select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
26 attr1
27 begin;
28 insert into t1 values(1,1);
29 insert into t1 values(2,2);
30 commit;
31 select count(*) from t1;
32 count(*)
33 2
34 select * from t1 where pk1 = 1;
35 pk1 attr1
36 1 1
37 select t1.attr1 from t1, t1 as t1x where t1.pk1 = t1x.pk1 + 1;
38 attr1
39 2
40 begin;
41 update t1 set attr1 = attr1 * 2;
42 select count(*) from t1;
43 count(*)
44 2
45 select * from t1 where pk1 = 1;
46 pk1 attr1
47 1 2
48 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
49 pk1 attr1 pk1 attr1
50 2 4 1 2
51 rollback;
52 select count(*) from t1;
53 count(*)
54 2
55 select * from t1 where pk1 = 1;
56 pk1 attr1
57 1 1
58 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
59 pk1 attr1 pk1 attr1
60 begin;
61 update t1 set attr1 = attr1 * 2;
62 commit;
63 select count(*) from t1;
64 count(*)
65 2
66 select * from t1 where pk1 = 1;
67 pk1 attr1
68 1 2
69 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
70 pk1 attr1 pk1 attr1
71 2 4 1 2
72 begin;
73 delete from t1 where attr1 = 2;
74 select count(*) from t1;
75 count(*)
76 1
77 select * from t1 where pk1 = 1;
78 pk1 attr1
79 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
80 pk1 attr1 pk1 attr1
81 rollback;
82 select count(*) from t1;
83 count(*)
84 2
85 select * from t1 where pk1 = 1;
86 pk1 attr1
87 1 2
88 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
89 pk1 attr1 pk1 attr1
90 2 4 1 2
91 begin;
92 delete from t1 where attr1 = 2;
93 commit;
94 select count(*) from t1;
95 count(*)
96 1
97 select * from t1 where pk1 = 1;
98 pk1 attr1
99 select * from t1, t1 as t1x where t1x.attr1 = t1.attr1 - 2;
100 pk1 attr1 pk1 attr1
101 DROP TABLE t1;
102 CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
103 begin;
104 insert into t1 values(1,1);
105 insert into t1 values(2,2);
106 select sum(id) from t1;
107 sum(id)
108 3
109 select * from t1 where id = 1;
110 id id2
111 1 1
112 select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
113 id
114 2
115 rollback;
116 select sum(id) from t1;
117 sum(id)
118 NULL
119 select * from t1 where id = 1;
120 id id2
121 select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
122 id
123 begin;
124 insert into t1 values(1,1);
125 insert into t1 values(2,2);
126 commit;
127 select sum(id) from t1;
128 sum(id)
129 3
130 select * from t1 where id = 1;
131 id id2
132 1 1
133 select t1.id from t1, t1 as t1x where t1.id2 = t1x.id2 + 1;
134 id
135 2
136 begin;
137 update t1 set id = id * 2;
138 select sum(id) from t1;
139 sum(id)
140 6
141 select * from t1 where id = 2;
142 id id2
143 2 1
144 select * from t1, t1 as t1x where t1x.id = t1.id - 2;
145 id id2 id id2
146 4 2 2 1
147 rollback;
148 select sum(id) from t1;
149 sum(id)
150 3
151 select * from t1 where id = 2;
152 id id2
153 2 2
154 select * from t1, t1 as t1x where t1x.id = t1.id - 2;
155 id id2 id id2
156 begin;
157 update t1 set id = id * 2;
158 commit;
159 select sum(id) from t1;
160 sum(id)
161 6
162 select * from t1 where id = 2;
163 id id2
164 2 1
165 select * from t1, t1 as t1x where t1x.id = t1.id - 2;
166 id id2 id id2
167 4 2 2 1
168 DROP TABLE t1;
169 CREATE TABLE t2 (
170 a bigint unsigned NOT NULL PRIMARY KEY,
171 b int unsigned not null,
172 c int unsigned
173 ) engine=ndbcluster;
174 CREATE TABLE t3 (
175 a bigint unsigned NOT NULL,
176 b bigint unsigned not null,
177 c bigint unsigned,
178 PRIMARY KEY(a)
179 ) engine=ndbcluster;
180 CREATE TABLE t4 (
181 a bigint unsigned NOT NULL,
182 b bigint unsigned not null,
183 c bigint unsigned NOT NULL,
184 d int unsigned,
185 PRIMARY KEY(a, b, c)
186 ) engine=ndbcluster;
187 select count(*) from t2;
188 count(*)
189 0
190 select count(*) from t3;
191 count(*)
192 0
193 select count(*) from t4;
194 count(*)
195 0
196 select count(*) from t2;
197 count(*)
198 100
199 select count(*) from t3;
200 count(*)
201 100
202 select count(*) from t4;
203 count(*)
204 100
205 begin;
206 begin;
207 drop table t2;
208 drop table t3;
209 drop table t4;
210 CREATE TABLE t1 (
211 pk1 INT NOT NULL PRIMARY KEY,
212 attr1 INT NOT NULL
213 ) ENGINE=ndbcluster;
214 create database mysqltest;
215 use mysqltest;
216 CREATE TABLE t2 (
217 a bigint unsigned NOT NULL PRIMARY KEY,
218 b int unsigned not null,
219 c int unsigned
220 ) engine=ndbcluster;
221 begin;
222 insert into test.t1 values(1,1);
223 insert into t2 values(1,1,1);
224 insert into test.t1 values(2,2);
225 insert into t2 values(2,2,2);
226 select count(*) from test.t1;
227 count(*)
228 2
229 select count(*) from t2;
230 count(*)
231 2
232 select * from test.t1 where pk1 = 1;
233 pk1 attr1
234 1 1
235 select * from t2 where a = 1;
236 a b c
237 1 1 1
238 select test.t1.attr1
239 from test.t1, test.t1 as t1x where test.t1.pk1 = t1x.pk1 + 1;
240 attr1
241 2
242 select t2.a
243 from t2, t2 as t2x where t2.a = t2x.a + 1;
244 a
245 2
246 select test.t1.pk1, a from test.t1,t2 where b > test.t1.attr1;
247 pk1 a
248 1 2
249 rollback;
250 select count(*) from test.t1;
251 count(*)
252 0
253 select count(*) from t2;
254 count(*)
255 0
256 drop table test.t1, t2;
257 drop database mysqltest;