~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/blitzdb/tests/r/basic.result

  • Committer: Brian Aker
  • Date: 2010-12-08 22:35:56 UTC
  • mfrom: (1819.9.158 update-innobase)
  • Revision ID: brian@tangent.org-20101208223556-37mi4omqg7lkjzf3
Merge in Stewart's changes, 1.3 changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1, t2;
 
2
create table t1 (a int, b double, c float) engine = blitzdb;
 
3
create table t2 (a int, b text, c blob) engine = blitzdb;
 
4
create table t1 (a int, b double, c float) engine = blitzdb;
 
5
ERROR 42S01: Table 'test.t1' already exists
 
6
create table t2 (a int, b text, c blob) engine = blitzdb;
 
7
ERROR 42S01: Table 'test.t2' already exists
 
8
create table t1 (a int) engine = blitzdb;
 
9
ERROR 42S01: Table 'test.t1' already exists
 
10
create table t2 (a int) engine = blitzdb;
 
11
ERROR 42S01: Table 'test.t2' already exists
 
12
show tables;
 
13
Tables_in_test
 
14
t1
 
15
t2
 
16
drop table t1, t2;
 
17
create table t1 (a int, b int, c varchar(255)) engine = blitzdb;
 
18
insert into t1 values (1, 8, "one");
 
19
select * from t1;
 
20
a       b       c
 
21
1       8       one
 
22
insert into t1 values (2, 7, "two");
 
23
insert into t1 values (3, 6, "three");
 
24
insert into t1 values (4, 5, "four");
 
25
insert into t1 values (5, 4, "five");
 
26
insert into t1 values (6, 3, "six");
 
27
insert into t1 values (7, 2, "seven");
 
28
insert into t1 values (8, 1, "eight");
 
29
select count(*) from t1;
 
30
count(*)
 
31
8
 
32
select c from t1 where a = 4;
 
33
c
 
34
four
 
35
select c from t1 where a > 5;
 
36
c
 
37
six
 
38
seven
 
39
eight
 
40
select * from t1;
 
41
a       b       c
 
42
1       8       one
 
43
2       7       two
 
44
3       6       three
 
45
4       5       four
 
46
5       4       five
 
47
6       3       six
 
48
7       2       seven
 
49
8       1       eight
 
50
select * from t1 where a = 1 or b = 1;
 
51
a       b       c
 
52
1       8       one
 
53
8       1       eight
 
54
select substring(c, 1, 3) from t1;
 
55
substring(c, 1, 3)
 
56
one
 
57
two
 
58
thr
 
59
fou
 
60
fiv
 
61
six
 
62
sev
 
63
eig
 
64
select substring(c, 1, 2) from t1;
 
65
substring(c, 1, 2)
 
66
on
 
67
tw
 
68
th
 
69
fo
 
70
fi
 
71
si
 
72
se
 
73
ei
 
74
select substring(c, 1, 1) from t1;
 
75
substring(c, 1, 1)
 
76
o
 
77
t
 
78
t
 
79
f
 
80
f
 
81
s
 
82
s
 
83
e
 
84
update t1 set c = "first half" where a <= 4;
 
85
update t1 set c = "second half" where a > 4;
 
86
select * from t1;
 
87
a       b       c
 
88
1       8       first half
 
89
2       7       first half
 
90
3       6       first half
 
91
4       5       first half
 
92
5       4       second half
 
93
6       3       second half
 
94
7       2       second half
 
95
8       1       second half
 
96
create table t2 (a int, b int, c varchar(255))
 
97
engine = blitzdb (select * from t1);
 
98
show create table t2;
 
99
Table   Create Table
 
100
t2      CREATE TABLE `t2` (
 
101
  `a` INT DEFAULT NULL,
 
102
  `b` INT DEFAULT NULL,
 
103
  `c` VARCHAR(255) COLLATE utf8_general_ci DEFAULT NULL
 
104
) ENGINE=BLITZDB COLLATE = utf8_general_ci
 
105
select count(*) from t2;
 
106
count(*)
 
107
8
 
108
delete from t1 where c = "first half";
 
109
delete from t1 where c = "second half";
 
110
select count(*) from t1;
 
111
count(*)
 
112
0
 
113
drop table t1;
 
114
rename table t2 to t1;
 
115
select * from t1;
 
116
a       b       c
 
117
1       8       first half
 
118
2       7       first half
 
119
3       6       first half
 
120
4       5       first half
 
121
5       4       second half
 
122
6       3       second half
 
123
7       2       second half
 
124
8       1       second half
 
125
drop table t1;
 
126
create table t1 (id int) engine = blitzdb;
 
127
insert into t1 values (100), (100);
 
128
update t1 set id = id+1 ORDER BY id LIMIT 2;
 
129
update t1 set id = id+1 ORDER BY id LIMIT 2;
 
130
update t1 set id = id+1 ORDER BY id LIMIT 2;
 
131
update t1 set id = id+1 ORDER BY id LIMIT 2;
 
132
select * from t1;
 
133
id
 
134
104
 
135
104
 
136
drop table t1;
 
137
create table t1 (a int) engine = blitzdb;
 
138
insert into t1 values (1), (2), (3), (4);
 
139
alter table t1 add b int;
 
140
select * from t1;
 
141
a       b
 
142
1       NULL
 
143
2       NULL
 
144
3       NULL
 
145
4       NULL
 
146
update t1 set b = 1 where a = 1;
 
147
update t1 set b = 2 where a = 2;
 
148
update t1 set b = 3 where a = 3;
 
149
update t1 set b = 4 where a = 4;
 
150
select * from t1;
 
151
a       b
 
152
1       1
 
153
2       2
 
154
3       3
 
155
4       4
 
156
alter table t1 add c text;
 
157
update t1 set c = "added column" where a = 1;
 
158
update t1 set c = "added column" where a = 2;
 
159
update t1 set c = "added column" where a = 3;
 
160
update t1 set c = "added column" where a = 4;
 
161
select * from t1;
 
162
a       b       c
 
163
1       1       added column
 
164
2       2       added column
 
165
3       3       added column
 
166
4       4       added column
 
167
drop table t1;
 
168
create table t1 (name varchar(32), point int) engine = blitzdb;
 
169
insert into t1 values ('aaa', 10);
 
170
insert into t1 values ('bbb', 20);
 
171
insert into t1 values ('ccc', 30);
 
172
insert into t1 values ('aaa', 10);
 
173
insert into t1 values ('bbb', 20);
 
174
insert into t1 values ('ccc', 30);
 
175
insert into t1 values ('aaa', 10);
 
176
insert into t1 values ('bbb', 20);
 
177
insert into t1 values ('ccc', 30);
 
178
select * from t1;
 
179
name    point
 
180
aaa     10
 
181
bbb     20
 
182
ccc     30
 
183
aaa     10
 
184
bbb     20
 
185
ccc     30
 
186
aaa     10
 
187
bbb     20
 
188
ccc     30
 
189
select name, sum(point) from t1 group by name;
 
190
name    sum(point)
 
191
aaa     30
 
192
bbb     60
 
193
ccc     90
 
194
drop table t1;
 
195
create table t1 (string varchar(255)) engine = blitzdb;
 
196
insert into t1 values('accompany'), ('balcony'), ('bunny'), ('company');
 
197
insert into t1 values('accompanied'), ('amazed'), ('busted'), ('decreased');
 
198
insert into t1 values('achiever'), ('blender'), ('ether'), ('launcher');
 
199
insert into t1 values('ampersand'), ('compound'), ('comprehend'), ('wand');
 
200
select * from t1 where string like '%ny';
 
201
string
 
202
accompany
 
203
balcony
 
204
bunny
 
205
company
 
206
select * from t1 where string like '%ed';
 
207
string
 
208
accompanied
 
209
amazed
 
210
busted
 
211
decreased
 
212
select * from t1 where string like '%er';
 
213
string
 
214
achiever
 
215
blender
 
216
ether
 
217
launcher
 
218
select * from t1 where string like '%nd';
 
219
string
 
220
ampersand
 
221
compound
 
222
comprehend
 
223
wand
 
224
select * from t1 where string like 'a%';
 
225
string
 
226
accompany
 
227
accompanied
 
228
amazed
 
229
achiever
 
230
ampersand
 
231
select * from t1 where string like 'ac%';
 
232
string
 
233
accompany
 
234
accompanied
 
235
achiever
 
236
select * from t1 where string like 'acc%';
 
237
string
 
238
accompany
 
239
accompanied
 
240
select * from t1 where string like '____';
 
241
string
 
242
wand
 
243
select * from t1 where string like '_____';
 
244
string
 
245
bunny
 
246
ether
 
247
select * from t1 where string like '___________';
 
248
string
 
249
accompanied
 
250
drop table t1;
 
251
create table t1 (a int not null, b int) engine = blitzdb;
 
252
insert into t1 values (1, NULL), (2, NULL), (3, NULL), (4, NULL);
 
253
insert into t1 values (5, NULL), (6, NULL), (7, NULL), (8, NULL);
 
254
insert into t1 values (NULL, 1);
 
255
ERROR 23000: Column 'a' cannot be null
 
256
select * from t1;
 
257
a       b
 
258
1       NULL
 
259
2       NULL
 
260
3       NULL
 
261
4       NULL
 
262
5       NULL
 
263
6       NULL
 
264
7       NULL
 
265
8       NULL
 
266
select * from t1 where a is null;
 
267
a       b
 
268
select * from t1 where b is null;
 
269
a       b
 
270
1       NULL
 
271
2       NULL
 
272
3       NULL
 
273
4       NULL
 
274
5       NULL
 
275
6       NULL
 
276
7       NULL
 
277
8       NULL
 
278
drop table t1;
 
279
create table t1 (name varchar(64), dob date) engine = blitzdb;
 
280
insert into t1 values ('Bernstein', '1971-10-29');
 
281
insert into t1 values ('Codd', '1923-08-23');
 
282
insert into t1 values ('Lovelace', '1815-12-10');
 
283
insert into t1 values ('Tower', '1949-06-17');
 
284
insert into t1 values ('Turing', '1912-06-23');
 
285
insert into t1 values ('Thompson', '1943-02-04');
 
286
select * from t1;
 
287
name    dob
 
288
Bernstein       1971-10-29
 
289
Codd    1923-08-23
 
290
Lovelace        1815-12-10
 
291
Tower   1949-06-17
 
292
Turing  1912-06-23
 
293
Thompson        1943-02-04
 
294
select name from t1 order by dob;
 
295
name
 
296
Lovelace
 
297
Turing
 
298
Codd
 
299
Thompson
 
300
Tower
 
301
Bernstein
 
302
select name from t1 order by dob desc;
 
303
name
 
304
Bernstein
 
305
Tower
 
306
Thompson
 
307
Codd
 
308
Turing
 
309
Lovelace
 
310
select name from t1 where dob < '1900-01-01';
 
311
name
 
312
Lovelace
 
313
select name from t1 where dob > '1950-01-01';
 
314
name
 
315
Bernstein
 
316
select name from t1 where dob = '1943-02-04';
 
317
name
 
318
Thompson
 
319
drop table t1;
 
320
create table t1 (a int) engine = blitzdb;
 
321
insert into t1 values(2147483649);
 
322
ERROR 22003: Out of range value for column 'a' at row 1
 
323
insert into t1 values(-2147483649);
 
324
ERROR 22003: Out of range value for column 'a' at row 1
 
325
insert into t1 values(2147483647);
 
326
select * from t1;
 
327
a
 
328
2147483647
 
329
drop table t1;
 
330
create table t1 (a varchar(32)) engine = blitzdb;
 
331
insert into t1 select repeat('x', 4);
 
332
insert into t1 select repeat('x', 6);
 
333
insert into t1 select repeat('x', 8);
 
334
insert into t1 select repeat('x', 16);
 
335
insert into t1 select repeat('x', 32);
 
336
insert into t1 select repeat('x', 33);
 
337
ERROR 22001: Data too long for column 'a' at row 1
 
338
select * from t1;
 
339
a
 
340
xxxx
 
341
xxxxxx
 
342
xxxxxxxx
 
343
xxxxxxxxxxxxxxxx
 
344
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
345
create table t2 (a varchar(16383)) engine = blitzdb;
 
346
insert into t2 select repeat('x', 16383);
 
347
insert into t2 select repeat('x', 16384);
 
348
ERROR 22001: Data too long for column 'a' at row 1
 
349
select count(*) from t2;
 
350
count(*)
 
351
1
 
352
drop table t1, t2;
 
353
create table t1 (a varchar(32)) engine = blitzdb;
 
354
insert into t1 select repeat('あ', 8);
 
355
insert into t1 select repeat('あ', 32);
 
356
insert into t1 select repeat('あ', 33);
 
357
ERROR 22001: Data too long for column 'a' at row 1
 
358
select * from t1;
 
359
a
 
360
ああああああああ
 
361
ああああああああああああああああああああああああああああああああ
 
362
create table t2 (a varchar(16383)) engine = blitzdb;
 
363
insert into t2 select repeat('値', 16383);
 
364
insert into t2 select repeat('値', 16384);
 
365
ERROR 22001: Data too long for column 'a' at row 1
 
366
select count(*) from t2;
 
367
count(*)
 
368
1
 
369
drop table t1, t2;
 
370
create table t1 (a int, b varchar(255)) engine = blitzdb;
 
371
insert into t1 values (1, 'one'), (2, 'two'), (3, 'three'), (4, 'four');
 
372
insert into t1 values (5, 'five'), (6, 'six'), (7, 'seven'), (8, 'eight');
 
373
create table t2 (a int, b varchar(255), c double) engine = blitzdb;
 
374
insert into t2 (a, b) select a, b from t1 where a > 4;
 
375
insert into t2 (a) select a from t1 where a = 1;
 
376
select * from t2;
 
377
a       b       c
 
378
5       five    NULL
 
379
6       six     NULL
 
380
7       seven   NULL
 
381
8       eight   NULL
 
382
1       NULL    NULL
 
383
delete from t2;
 
384
insert into t2 (a, b) select * from t1;
 
385
select * from t2;
 
386
a       b       c
 
387
1       one     NULL
 
388
2       two     NULL
 
389
3       three   NULL
 
390
4       four    NULL
 
391
5       five    NULL
 
392
6       six     NULL
 
393
7       seven   NULL
 
394
8       eight   NULL
 
395
drop table t1;
 
396
create table t1 (a int, b varchar(2048)) engine = blitzdb;
 
397
insert into t1 values (1, 'abcdefghijklmn');
 
398
insert into t1 values (1, 'abcdefghijklmn');
 
399
insert into t1 values (1, 'abcdefghijklmn');
 
400
insert into t1 values (1, 'abcdefghijklmn');
 
401
select * from t1;
 
402
a       b
 
403
1       abcdefghijklmn
 
404
1       abcdefghijklmn
 
405
1       abcdefghijklmn
 
406
1       abcdefghijklmn
 
407
drop table t1;