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
17
create table t1 (a int, b int, c varchar(255)) engine = blitzdb;
18
insert into t1 values (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;
32
select c from t1 where a = 4;
35
select c from t1 where a > 5;
50
select * from t1 where a = 1 or b = 1;
54
select substring(c, 1, 3) from t1;
64
select substring(c, 1, 2) from t1;
74
select substring(c, 1, 1) from t1;
84
update t1 set c = "first half" where a <= 4;
85
update t1 set c = "second half" where a > 4;
96
create table t2 (a int, b int, c varchar(255))
97
engine = blitzdb (select * from t1);
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;
108
delete from t1 where c = "first half";
109
delete from t1 where c = "second half";
110
select count(*) from t1;
114
rename table t2 to 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;
137
create table t1 (a int) engine = blitzdb;
138
insert into t1 values (1), (2), (3), (4);
139
alter table t1 add b int;
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;
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;
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);
189
select name, sum(point) from t1 group by name;
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';
206
select * from t1 where string like '%ed';
212
select * from t1 where string like '%er';
218
select * from t1 where string like '%nd';
224
select * from t1 where string like 'a%';
231
select * from t1 where string like 'ac%';
236
select * from t1 where string like 'acc%';
240
select * from t1 where string like '____';
243
select * from t1 where string like '_____';
247
select * from t1 where string like '___________';
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
266
select * from t1 where a is null;
268
select * from t1 where b is null;
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');
294
select name from t1 order by dob;
302
select name from t1 order by dob desc;
310
select name from t1 where dob < '1900-01-01';
313
select name from t1 where dob > '1950-01-01';
316
select name from t1 where dob = '1943-02-04';
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);
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
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;
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
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;
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;
384
insert into t2 (a, b) select * from 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');