Oracle 5.0 Reference Manual page 974

Table of Contents

Advertisement

COMPRESS(string_to_compress)
Compresses a string and returns the result as a binary string. This function requires MySQL to have
been compiled with a compression library such as zlib. Otherwise, the return value is always NULL.
The compressed string can be uncompressed with
mysql>
SELECT LENGTH(COMPRESS(REPEAT('a',1000)));
-> 21
mysql>
SELECT LENGTH(COMPRESS(''));
-> 0
mysql>
SELECT LENGTH(COMPRESS('a'));
-> 13
mysql>
SELECT LENGTH(COMPRESS(REPEAT('a',16)));
-> 15
The compressed string contents are stored the following way:
• Empty strings are stored as empty strings.
• Nonempty strings are stored as a 4-byte length of the uncompressed string (low byte first),
followed by the compressed string. If the string ends with space, an extra "." character is added
to avoid problems with endspace trimming should the result be stored in a
column. (However, use of nonbinary string data types such as
compressed strings is not recommended anyway because character set conversion may occur.
Use a
VARBINARY
DECODE(crypt_str,pass_str)
Decrypts the encrypted string
a string returned from
DES_DECRYPT(crypt_str[,key_str])
Decrypts a string encrypted with
NULL.
This function works only if MySQL has been configured with SSL support. See
SSL for Secure
Connections".
If no
argument is given,
key_str
string to determine the DES key number that was used to encrypt the original string, and then reads
the key from the DES key file to decrypt the message. For this to work, the user must have the
[578]
privilege. The key file can be specified with the
SUPER
If you pass this function a
message.
If the
argument does not appear to be an encrypted string, MySQL returns the given
crypt_str
crypt_str.
DES_ENCRYPT(str[,{key_num|key_str}])
Encrypts the string with the given key using the Triple-DES algorithm.
This function works only if MySQL has been configured with SSL support. See
SSL for Secure
Connections".
The encryption key to use is chosen based on the second argument to
if one was given. With no argument, the first key from the DES key file is used. With a
argument, the given key number (0 to 9) from the DES key file is used. With a
the given key string is used to encrypt str.
The key file can be specified with the
Encryption and Compression Functions
[954]
or
binary string column instead.)
BLOB
[954]
using
crypt_str
[955].
ENCODE()
DES_ENCRYPT()
DES_DECRYPT()
argument, that string is used as the key for decrypting the
key_str
--des-key-file
954
UNCOMPRESS()
CHAR
as the password.
pass_str
[954]
[954]. If an error occurs, this function returns
[954]
examines the first byte of the encrypted
--des-key-file
[954]
[407]
server option.
[957].
or
CHAR
VARCHAR
or
to store
VARCHAR
crypt_str
Section 6.3.6, "Using
[407]
server option.
Section 6.3.6, "Using
[954],
DES_ENCRYPT()
key_num
argument,
key_str
should be

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents