Skip to content
Blog

Blob Functions

FunctionDescriptionExampleResult
BLOB(string)creates a BLOB object using stringblob('\xAA\xBD')'\xAA\xBD'
encode(string)converts the given string to blob. UTF-8 characters are converted using literal encodingencode('this 中文')'this \xE4\xB8\xAD\xE6\x96\x87'
decode(blob)converts the given blob to string. Throws exception if blob is not valid UTF-8 stringdecode('this \xE4\xB8\xAD\xE6\x96\x87')'this 中文'
octet_length(blob)returns the number of bytes of the given blob objectoctet_length('\xAA\xDE\xAD')3