~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
2
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
3
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
4
select length(@test_compress_string);
5
length(@test_compress_string)
6
117
7
select uncompress(compress(@test_compress_string));
8
uncompress(compress(@test_compress_string))
9
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
10
explain extended select uncompress(compress(@test_compress_string));
11
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
12
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
13
Warnings:
14
Note	1003	select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
15
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
16
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
17
1
18
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
19
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
20
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
21
Warnings:
22
Note	1003	select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
23
select uncompressed_length(compress(@test_compress_string));
24
uncompressed_length(compress(@test_compress_string))
25
117
26
select length(compress(@test_compress_string))<length(@test_compress_string);
27
length(compress(@test_compress_string))<length(@test_compress_string)
28
1
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
29
create table t1 (a blob, b blob, c varchar(4));
1 by brian
clean slate
30
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
31
select uncompress(a) from t1;
32
uncompress(a)
33
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
34
select uncompress(b) from t1;
35
uncompress(b)
36
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
37
select concat('|',c,'|') from t1;
38
concat('|',c,'|')
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
39
|d |
1 by brian
clean slate
40
drop table t1;
41
select compress("");
42
compress("")
43
44
select uncompress("");
45
uncompress("")
46
47
select uncompress(compress(""));
48
uncompress(compress(""))
49
50
select uncompressed_length("");
51
uncompressed_length("")
52
0
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
53
create table t1 (a blob);
1 by brian
clean slate
54
insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
55
select length(a) from t1;
56
length(a)
57
NULL
58
12
59
76
60
50000
61
select length(uncompress(a)) from t1;
62
length(uncompress(a))
63
NULL
64
NULL
65
50000
66
NULL
67
Warnings:
68
Error	1259	ZLIB: Input data corrupted
69
Error	1256	Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
70
drop table t1;
71
set @@max_allowed_packet=1048576*100;
72
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
73
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
74
0
75
create table t1(a blob);
76
insert into t1 values(NULL), (compress('a'));
77
select uncompress(a), uncompressed_length(a) from t1;
78
uncompress(a)	uncompressed_length(a)
79
NULL	NULL
80
a	1
81
drop table t1;
82
create table t1(a blob);
83
insert into t1 values ('0'), (NULL), ('0');
84
select compress(a), compress(a) from t1;
85
select compress(a) is null from t1;
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
86
compress(a) is null 
1 by brian
clean slate
87
0
88
1
89
0
90
drop table t1;
91
End of 4.1 tests
92
create table t1 (a varchar(32) not null);
93
insert into t1 values ('foo');
94
explain select * from t1 where uncompress(a) is null;
95
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
96
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1	Using where
1 by brian
clean slate
97
select * from t1 where uncompress(a) is null;
98
a
99
foo
100
Warnings:
101
Error	1259	ZLIB: Input data corrupted
102
explain select *, uncompress(a) from t1;
103
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
104
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1	
1 by brian
clean slate
105
select *, uncompress(a) from t1;
106
a	uncompress(a)
107
foo	NULL
108
Warnings:
109
Error	1259	ZLIB: Input data corrupted
110
select *, uncompress(a), uncompress(a) is null from t1;
139.1.9 by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test
111
a	uncompress(a)	uncompress(a) is null 
1 by brian
clean slate
112
foo	NULL	1
113
Warnings:
114
Error	1259	ZLIB: Input data corrupted
115
Error	1259	ZLIB: Input data corrupted
116
drop table t1;
117
End of 5.0 tests
997.8.3 by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests
118
select compress();
119
ERROR 42000: Incorrect parameters in the call to native function 'compress'
120
select uncompress();
121
ERROR 42000: Incorrect parameters in the call to native function 'uncompress'
122
select uncompressed_length();
123
ERROR 42000: Incorrect parameters in the call to native function 'uncompressed_length'
124
select compress('aeou', 'aoeu', 'aoeu');
125
ERROR 42000: Incorrect parameters in the call to native function 'compress'
126
select uncompress('aoenuthn', 'aoeu');
127
ERROR 42000: Incorrect parameters in the call to native function 'uncompress'
128
select uncompressed_length('aneohusa','naohuntah','onh');
129
ERROR 42000: Incorrect parameters in the call to native function 'uncompressed_length'