mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
-- source include/have_compress.inc
 | 
						|
#
 | 
						|
# Test for compress and uncompress functions:
 | 
						|
#
 | 
						|
# Note that this test gives error in the gzip library when running under
 | 
						|
# valgrind, but these warnings can be ignored
 | 
						|
 | 
						|
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;
 | 
						|
 | 
						|
 | 
						|
#
 | 
						|
# Bug #5497: a problem with large strings
 | 
						|
# note that when LOW_MEMORY is set the "test" below is meaningless
 | 
						|
#
 | 
						|
 | 
						|
set @@max_allowed_packet=1048576*100;
 | 
						|
--replace_result "''" XXX "'1'" XXX
 | 
						|
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
 | 
						|
 |