Name

gzip_uncompress, gz_compress_file, gz_uncompress_file, unzip_file, unzip_list, xz_file_open, bz2_file_open — compress, decompress and read compressed files

Synopsis

any gzip_uncompress( in input any);
 
integer gz_compress_file( in source_file varchar,
  in target_file varchar);
 
integer gz_uncompress_file( in source_file varchar,
  in target_file varchar);
 
unzip_file( in zip_archive varchar,
  in entry_name varchar,
  in target_file varchar);
 
any unzip_list( in zip_archive varchar);
 
any xz_file_open( in file varchar);
 
any bz2_file_open( in file varchar);
 

Description

gzip_uncompress decompresses a gzip-compressed string or string_output in memory and returns the plaintext as a new string. It is the in-memory counterpart of gz_uncompress.

gz_compress_file reads source_file and writes a gzip-compressed copy to target_file. gz_uncompress_file reverses the operation, expanding a .gz file. Both return a non-zero integer status on success and raise an SQL error on I/O or compression failure. DBA privileges are required.

unzip_file extracts the entry named entry_name from a ZIP archive. With three arguments the entry is written to target_file; with two arguments the decompressed bytes are returned as a string. unzip_list returns a vector describing every entry in the archive (name, uncompressed size, compressed size, modification timestamp).

xz_file_open opens an XZ/LZMA-compressed file for streaming reads, returning a file-descriptor handle suitable for use with the standard file_* reading BIFs. bz2_file_open performs the same role for bzip2-compressed files. Both expose the decompressed bytes through an ordinary file-descriptor interface and are particularly useful for processing large compressed datasets without materialising the whole content in memory.


© 1992 - OpenLink Software. All rights reserved.

Making Technology Work for You®