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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
drop table if exists t1, t2;
create table t1 (a decimal, b decimal) engine = blitzdb;
insert into t1 values (1,0);
insert into t1 values (1,1);
insert into t1 values (1,2);
insert into t1 values (1,4);
insert into t1 values (1,8);
select * from t1;
a b
1 0
1 1
1 2
1 4
1 8
select * from t1 where b <= 2;
a b
1 0
1 1
1 2
drop table t1;
create table t2 (a decimal(65,0)) engine = blitzdb;
insert into t2 select repeat(1, 65);
insert into t2 select repeat(1, 66);
ERROR 22003: Out of range value for column 'a' at row 1
select * from t2;
a
11111111111111111111111111111111111111111111111111111111111111111
drop table t2;
create table t2 (a decimal(65,8)) engine = blitzdb;
insert into t2 select repeat(1, 57);
insert into t2 select repeat(1, 58);
ERROR 22003: Out of range value for column 'a' at row 1
delete from t2;
insert into t2 values (
-1111111111111111111111111111111111111111111111111111111111
);
ERROR 22003: Out of range value for column 'a' at row 1
insert into t2 values (
1111111111111111111111111111111111111111111111111.11111111
);
insert into t2 values (
111111111111111111111111111111111111111111111111.111111111
);
ERROR 01000: Data truncated for column 'a' at row 1
select * from t2;
a
1111111111111111111111111111111111111111111111111.11111111
drop table t2;
create table t1 (
id int NOT NULL auto_increment,
datatype_id int DEFAULT '0' NOT NULL,
minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
valuename varchar(20),
forecolor int,
backcolor int,
primary key (id),
index datatype_id (datatype_id)
) engine = blitzdb;
insert into t1 values ('1', '4', '0.0000000000', '0.0000000000', 'Ei saja', '0', '16776960');
insert into t1 values ('2', '4', '1.0000000000', '1.0000000000', 'Sajab', '16777215', '255');
insert into t1 values ('3', '1', '2.0000000000', '49.0000000000', '', '0', '16777215');
insert into t1 values ('60', '11', '0.0000000000', '0.0000000000', 'Rikkis', '16777215', '16711680');
insert into t1 values ('4', '12', '1.0000000000', '1.0000000000', 'nork sadu', '65280', '14474460');
insert into t1 values ('5', '12', '2.0000000000', '2.0000000000', 'keskmine sadu', '255', '14474460');
insert into t1 values ('6', '12', '3.0000000000', '3.0000000000', 'tugev sadu', '127', '14474460');
insert into t1 values ('43', '39', '6.0000000000', '6.0000000000', 'lobjakas', '13107327', '16763080');
insert into t1 values ('40', '39', '2.0000000000', '2.0000000000', 'vihm', '8355839', '16777215');
insert into t1 values ('53', '1', '-35.0000000000', '-5.0000000000', '', '0', '16777215');
insert into t1 values ('12', '21', '21.0000000000', '21.0000000000', 'Kuiv', '13158600', '16777215');
insert into t1 values ('14', '21', '22.0000000000', '22.0000000000', 'Niiske', '9869055', '16777215');
insert into t1 values ('16', '21', '31.0000000000', '31.0000000000', 'Kuiv', '13158600', '16777215');
insert into t1 values ('17', '21', '12.0000000000', '12.0000000000', 'Niiske', '9869055', '16777215');
insert into t1 values ('18', '21', '32.0000000000', '32.0000000000', 'Niiske', '9869055', '16777215');
insert into t1 values ('21', '21', '11.0000000000', '11.0000000000', 'Kuiv', '13158600', '16777215');
insert into t1 values ('22', '33', '21.0000000000', '21.0000000000', 'Pilves, kuiv', '8355711', '12632256');
insert into t1 values ('24', '33', '22.0000000000', '22.0000000000', 'Pilves, niiske', '8355711', '12632319');
insert into t1 values ('26', '33', '31.0000000000', '31.0000000000', 'Selge, kuiv', '16777215', '12632256');
insert into t1 values ('27', '33', '12.0000000000', '12.0000000000', 'Sajab, niiske', '0', '12632319');
insert into t1 values ('28', '33', '32.0000000000', '32.0000000000', 'Selge, niiske', '16777215', '12632319');
insert into t1 values ('31', '33', '11.0000000000', '11.0000000000', 'Sajab, kuiv', '0', '12632256');
insert into t1 values ('32', '11', '1.0000000000', '1.0000000000', 'Korras', '16777215', '49152');
insert into t1 values ('34', '21', '134.0000000000', '134.0000000000', 'Hoiatus, M+S!', '255', '13158600');
insert into t1 values ('39', '39', '1.0000000000', '1.0000000000', 'ei saja', '11206570', '16777215');
insert into t1 values ('44', '39', '4.0000000000', '5.0000000000', 'lumi', '16711680', '16763080');
insert into t1 values ('45', '12', '0.0000000000', '0.0000000000', '', '16777215', '14474460');
select * from t1 order by id;
id datatype_id minvalue maxvalue valuename forecolor backcolor
1 4 0.0000000000 0.0000000000 Ei saja 0 16776960
2 4 1.0000000000 1.0000000000 Sajab 16777215 255
3 1 2.0000000000 49.0000000000 0 16777215
4 12 1.0000000000 1.0000000000 nork sadu 65280 14474460
5 12 2.0000000000 2.0000000000 keskmine sadu 255 14474460
6 12 3.0000000000 3.0000000000 tugev sadu 127 14474460
12 21 21.0000000000 21.0000000000 Kuiv 13158600 16777215
14 21 22.0000000000 22.0000000000 Niiske 9869055 16777215
16 21 31.0000000000 31.0000000000 Kuiv 13158600 16777215
17 21 12.0000000000 12.0000000000 Niiske 9869055 16777215
18 21 32.0000000000 32.0000000000 Niiske 9869055 16777215
21 21 11.0000000000 11.0000000000 Kuiv 13158600 16777215
22 33 21.0000000000 21.0000000000 Pilves, kuiv 8355711 12632256
24 33 22.0000000000 22.0000000000 Pilves, niiske 8355711 12632319
26 33 31.0000000000 31.0000000000 Selge, kuiv 16777215 12632256
27 33 12.0000000000 12.0000000000 Sajab, niiske 0 12632319
28 33 32.0000000000 32.0000000000 Selge, niiske 16777215 12632319
31 33 11.0000000000 11.0000000000 Sajab, kuiv 0 12632256
32 11 1.0000000000 1.0000000000 Korras 16777215 49152
34 21 134.0000000000 134.0000000000 Hoiatus, M+S! 255 13158600
39 39 1.0000000000 1.0000000000 ei saja 11206570 16777215
40 39 2.0000000000 2.0000000000 vihm 8355839 16777215
43 39 6.0000000000 6.0000000000 lobjakas 13107327 16763080
44 39 4.0000000000 5.0000000000 lumi 16711680 16763080
45 12 0.0000000000 0.0000000000 16777215 14474460
53 1 -35.0000000000 -5.0000000000 0 16777215
60 11 0.0000000000 0.0000000000 Rikkis 16777215 16711680
select * from t1 where minvalue <= 1 and maxvalue >= -1 order by id;
id datatype_id minvalue maxvalue valuename forecolor backcolor
1 4 0.0000000000 0.0000000000 Ei saja 0 16776960
2 4 1.0000000000 1.0000000000 Sajab 16777215 255
4 12 1.0000000000 1.0000000000 nork sadu 65280 14474460
32 11 1.0000000000 1.0000000000 Korras 16777215 49152
39 39 1.0000000000 1.0000000000 ei saja 11206570 16777215
45 12 0.0000000000 0.0000000000 16777215 14474460
60 11 0.0000000000 0.0000000000 Rikkis 16777215 16711680
drop table t1;
create table t1 (a decimal(10,0)) engine = blitzdb;
insert into t1 values ("1e4294967295");
ERROR HY000: Incorrect decimal value: '1e4294967295' for column 'a' at row 1
select * from t1;
a
delete from t1;
insert into t1 values("1e4294967297");
ERROR HY000: Incorrect decimal value: '1e4294967297' for column 'a' at row 1
select * from t1;
a
drop table t1;
|