~drizzle-trunk/drizzle/development

2194.4.2 by Brian Aker
Bit functions/fix for <<
1
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
2
1+1	1-1	1+1*2	8/5	8%5	mod(8,5)	mod(8,5)|0	-(1+1)*-2
1 by brian
clean slate
3
2	0	3	1.6000	3	3	3	4
2194.4.2 by Brian Aker
Bit functions/fix for <<
4
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
5
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
6
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
7
Warnings:
8
Note	1003	select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
9
select 1 | (1+1),5 & 3, bit_count(7) ;
10
1 | (1+1)	5 & 3	bit_count(7)
11
3	1	3
12
explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
13
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
14
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
15
Warnings:
16
Note	1003	select (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
17
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
18
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '>> 60' at line 1
19
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, (1<< 63) >> 60;
20
1 << 32	1 << 63	1 << 64	4 >> 2	4 >> 63	(1<< 63) >> 60
21
4294967296	9223372036854775808	0	1	0	8
22
select -1 | 0, -1 ^ 0, -1 & 0;
23
-1 | 0	-1 ^ 0	-1 & 0
24
18446744073709551615	18446744073709551615	0
25
select -1 | 1, -1 ^ 1, -1 & 1;
26
-1 | 1	-1 ^ 1	-1 & 1
27
18446744073709551615	18446744073709551614	1
28
select  1 | -1,  1 ^ -1,  1 & -1;
29
1 | -1	1 ^ -1	1 & -1
30
18446744073709551615	18446744073709551614	1
31
select  0 | -1,  0 ^ -1,  0 & -1;
32
0 | -1	0 ^ -1	0 & -1
33
18446744073709551615	18446744073709551615	0
34
select -1 >> 0, -1 << 0;
35
-1 >> 0	-1 << 0
36
18446744073709551615	18446744073709551615
37
select -1 >> 1, -1 << 1;
38
-1 >> 1	-1 << 1
39
9223372036854775807	18446744073709551614
1 by brian
clean slate
40
drop table if exists t1,t2;
41
create table t1(a int);
42
create table t2(a int, b int);
43
insert into t1 values (1), (2), (3);
44
insert into t2 values (1, 7), (3, 7);
2194.4.2 by Brian Aker
Bit functions/fix for <<
45
select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
46
a	a	b	bit_count(t2.b)
47
1	1	7	3
48
2	NULL	NULL	NULL
49
3	3	7	3
1 by brian
clean slate
50
drop table t1, t2;