# 22. Virtuoso Functions Guide - gz_compress

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
gz_compress
gz_uncompress
string_output_gz_com...
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## gz_compress

Compress data using gzip algorithm
gz_compress (in str varchar);
Description

The gz_compress returns its argument compressed with the gzip algorithm. The argument and return values are arbitrary strings, possibly including any 8 bit characters.

Parameters
str – The string containing data to be compressed.
Return Types

A string containing the compressed data.

Examples
GZIP test 2

Just see how it compresses.

    create procedure
    gz_test_2 (in str varchar)
    {
      declare res any;
      declare _out varchar;
      declare _len integer;

      result_names (_out, _len);

      res := string_output ();
      result (str, length (str));
      str := gz_compress (str);
      result ('binary', length (str));
      gz_uncompress (str, res);
      result (res, length (res));
    }

    SQL> gz_test_2 ('f00f f00f m0053 2 w3r h4x0r7 ch002 00000000000000000000000');
    _out                      _len
    VARCHAR                   INTEGER
    _______________________________________________________________________________

    f00f f00f m0053 5 w3r h4x0r7 ch002 00000000000000000000000  58
    binary                    43
    f00f f00f m0053 5 w3r h4x0r7 ch002 00000000000000000000000  58

    3 Rows. -- 10 msec.
    SQL>

See Also

gz_uncompress, string_output_gz_compress, string_output.