summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_compress.test
blob: 79de99276a6bcc7f550d92ec83bc6e9813f48d8b (plain)
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
-- source include/have_compress.inc
#
# Test for compress and uncompress functions:
#

select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
select length(@test_compress_string);

select uncompress(compress(@test_compress_string));
explain extended select uncompress(compress(@test_compress_string));
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
select uncompressed_length(compress(@test_compress_string));
select length(compress(@test_compress_string))<length(@test_compress_string);

create table t1 (a text, b char(255), c char(4)) engine=myisam;
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
select uncompress(a) from t1;
select uncompress(b) from t1;
select concat('|',c,'|') from t1;
drop table t1;

select compress("");
select uncompress("");
select uncompress(compress(""));
select uncompressed_length("");

#
# errors
#

create table t1 (a text);
insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
select length(a) from t1;
select length(uncompress(a)) from t1;
drop table t1;