OCTET_ LENGTH
Returns the length of a value in bytes (octets).
This function corresponds to the octet_length(X) function in SQLite. It is an alias for length(X) when X is a BLOB. For any value, it returns the number of bytes in its BLOB representation.
For a BLOB, it returns the number of bytes in the blob.
For a string, it returns the number of bytes in its UTF-8 representation (which might differ from the character count returned by
LENGTH).For a numeric value, it's converted to a string, and the length of that string in bytes is returned.
For a NULL value, the result is
NULL.
This is particularly useful for determining the size of BLOB data or the byte-length of text data.
Example
// Get the size of a file stored as a BLOB
val fileSize = select(OCTET_LENGTH(Files.data)).from(Files).where(Files.id eq 1)
// For the string '€', LENGTH returns 1, but OCTET_LENGTH returns 3 (its UTF-8 byte size)Return
A KQLiteColumn of type Long containing the length of the value in bytes.
Author
MOHAMMAD AZIM ANSARI
Parameters
The column whose byte length is to be calculated.