ZLIB_COMPRESS
Syntax
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> ZLIB_COMPRESS[ZLIB_COMPRESS]:::quoted
ZLIB_COMPRESS --> End((END))
Purpose
The ZLIB_COMPRESS SQL function compresses a blob using the Zlib-algorithm.
See also ZLIB_DECOMPRESS and GZIP.
Parameters:
- input (
blob): Theblobto compress.
Returns: a Zlib-compressed version of the input.
Examples
The following example compresses and decompresses the nine ASCII characters ACME and retrieves the original text:
select blob_to_text(zlib_decompress(zlib_compress(ascii_to_blob('ACME'))))
-------------------
ACME
The following example compresses a text and retrieves the compressed blob encoded as base64:
select base64_encode(zlib_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpMaWIgY29tcHJlc3Npb24gbWV0aG9k'))
-------------------
eJwFwbkNgEAQA8BWXBAhERmPxa7E3aKzhaB7ZuZIIYUVD8eHq/oJ8zVcMGU4iGXKDXu1e1DK6mh01PEDjdMV+Q==