2003-04-10 02:50:30 +02:00
|
|
|
-- source include/have_compress.inc
|
|
|
|
#
|
|
|
|
# Test for compress and uncompress functions:
|
|
|
|
#
|
2005-01-12 02:38:53 +01:00
|
|
|
# Note that this test gives error in the gzip library when running under
|
|
|
|
# valgrind, but these warnings can be ignored
|
2003-04-10 02:50:30 +02:00
|
|
|
|
|
|
|
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
|
|
|
|
select length(@test_compress_string);
|
|
|
|
|
|
|
|
select uncompress(compress(@test_compress_string));
|
2003-10-30 11:57:26 +01:00
|
|
|
explain extended select uncompress(compress(@test_compress_string));
|
2003-04-10 02:50:30 +02:00
|
|
|
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
2003-10-30 11:57:26 +01:00
|
|
|
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
2003-04-10 02:50:30 +02:00
|
|
|
select uncompressed_length(compress(@test_compress_string));
|
|
|
|
select length(compress(@test_compress_string))<length(@test_compress_string);
|
|
|
|
|
2003-12-10 05:31:42 +01:00
|
|
|
create table t1 (a text, b char(255), c char(4)) engine=myisam;
|
2003-04-10 02:50:30 +02:00
|
|
|
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;
|
2003-04-23 00:41:47 +02:00
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
select compress("");
|
|
|
|
select uncompress("");
|
|
|
|
select uncompress(compress(""));
|
|
|
|
select uncompressed_length("");
|
|
|
|
|
2003-09-19 09:25:03 +02:00
|
|
|
#
|
2003-10-12 15:16:45 +02:00
|
|
|
# errors
|
2003-09-19 09:25:03 +02:00
|
|
|
#
|
|
|
|
|
2003-10-12 15:16:45 +02:00
|
|
|
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;
|
|
|
|
|
2004-09-13 15:43:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug #5497: a problem with large strings
|
2004-11-28 16:31:14 +01:00
|
|
|
# note that when LOW_MEMORY is set the "test" below is meaningless
|
2004-09-13 15:43:59 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
set @@max_allowed_packet=1048576*100;
|
2004-11-28 16:31:14 +01:00
|
|
|
--replace_result "''" XXX "'1'" XXX
|
|
|
|
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
|
|
|
|
|