139.1.9
by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test |
1 |
#-- source include/have_compress.inc
|
1
by brian
clean slate |
2 |
#
|
3 |
# Test for compress and uncompress functions:
|
|
4 |
#
|
|
5 |
# Note that this test gives error in the gzip library when running under
|
|
6 |
# valgrind, but these warnings can be ignored
|
|
7 |
||
8 |
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '; |
|
9 |
select length(@test_compress_string); |
|
10 |
||
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); |
|
17 |
||
139.1.9
by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test |
18 |
create table t1 (a blob, b blob, c varchar(4)); |
1
by brian
clean slate |
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; |
|
23 |
drop table t1; |
|
24 |
||
25 |
select compress(""); |
|
26 |
select uncompress(""); |
|
27 |
select uncompress(compress("")); |
|
28 |
select uncompressed_length(""); |
|
29 |
||
30 |
#
|
|
31 |
# errors
|
|
32 |
#
|
|
33 |
||
139.1.9
by Stewart Smith
Move compression functions (compress, uncompress and compressed_length) out into modules and fix test |
34 |
create table t1 (a blob); |
1
by brian
clean slate |
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; |
|
38 |
drop table t1; |
|
39 |
||
40 |
||
41 |
#
|
|
42 |
# Bug #5497: a problem with large strings
|
|
43 |
# note that when LOW_MEMORY is set the "test" below is meaningless
|
|
44 |
#
|
|
45 |
||
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; |
|
49 |
||
50 |
#
|
|
51 |
# Bug #18643: problem with null values
|
|
52 |
#
|
|
53 |
||
54 |
create table t1(a blob); |
|
55 |
insert into t1 values(NULL), (compress('a')); |
|
56 |
select uncompress(a), uncompressed_length(a) from t1; |
|
57 |
drop table t1; |
|
58 |
||
59 |
#
|
|
60 |
# Bug #23254: problem with compress(NULL)
|
|
61 |
#
|
|
62 |
||
63 |
create table t1(a blob); |
|
64 |
insert into t1 values ('0'), (NULL), ('0'); |
|
65 |
--disable_result_log |
|
66 |
select compress(a), compress(a) from t1; |
|
67 |
--enable_result_log |
|
68 |
select compress(a) is null from t1; |
|
69 |
drop table t1; |
|
70 |
||
71 |
--echo End of 4.1 tests |
|
72 |
||
73 |
#
|
|
74 |
# Bug #18539: uncompress(d) is null: impossible?
|
|
75 |
#
|
|
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; |
|
83 |
drop table t1; |
|
84 |
||
85 |
--echo End of 5.0 tests |
|
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
86 |
|
87 |
# parameter count
|
|
88 |
||
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
89 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
90 |
select compress(); |
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
91 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
92 |
select uncompress(); |
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
93 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
94 |
select uncompressed_length(); |
95 |
||
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
96 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
97 |
select compress('aeou', 'aoeu', 'aoeu'); |
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
98 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
99 |
select uncompress('aoenuthn', 'aoeu'); |
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
100 |
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION |
997.8.3
by Stewart Smith
fix function argument checking for (un)compress(ed_length) functions. also add tests |
101 |
select uncompressed_length('aneohusa','naohuntah','onh'); |