1
-- source include/have_compress.inc
3
# Test for compress and uncompress functions:
5
# Note that this test gives error in the gzip library when running under
6
# valgrind, but these warnings can be ignored
8
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
9
select length(@test_compress_string);
11
select uncompress(compress(@test_compress_string));
12
explain extended select uncompress(compress(@test_compress_string));
13
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
14
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
15
select uncompressed_length(compress(@test_compress_string));
16
select length(compress(@test_compress_string))<length(@test_compress_string);
18
create table t1 (a text, b char(255), c char(4)) engine=myisam;
19
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
20
select uncompress(a) from t1;
21
select uncompress(b) from t1;
22
select concat('|',c,'|') from t1;
26
select uncompress("");
27
select uncompress(compress(""));
28
select uncompressed_length("");
34
create table t1 (a text);
35
insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
36
select length(a) from t1;
37
select length(uncompress(a)) from t1;
42
# Bug #5497: a problem with large strings
43
# note that when LOW_MEMORY is set the "test" below is meaningless
46
set @@max_allowed_packet=1048576*100;
47
--replace_result "''" XXX "'1'" XXX
48
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
51
# Bug #18643: problem with null values
54
create table t1(a blob);
55
insert into t1 values(NULL), (compress('a'));
56
select uncompress(a), uncompressed_length(a) from t1;
60
# Bug #23254: problem with compress(NULL)
63
create table t1(a blob);
64
insert into t1 values ('0'), (NULL), ('0');
66
select compress(a), compress(a) from t1;
68
select compress(a) is null from t1;
71
--echo End of 4.1 tests
74
# Bug #18539: uncompress(d) is null: impossible?
76
create table t1 (a varchar(32) not null);
77
insert into t1 values ('foo');
78
explain select * from t1 where uncompress(a) is null;
79
select * from t1 where uncompress(a) is null;
80
explain select *, uncompress(a) from t1;
81
select *, uncompress(a) from t1;
82
select *, uncompress(a), uncompress(a) is null from t1;
85
--echo End of 5.0 tests