BLOB to text

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11 (Modified)


BLOB to text (blob; textFormat{; offset{; textLength}}) Text

ParameterTypeDescription
blobBLOBBLOB from which to get the text
textFormatNumberFormat and character set of text
offsetVariableOffset within the BLOB (expressed in bytes)
New offset after reading
textLengthNumberNumber of characters to be read
Function resultTextText extracted

Description

The BLOB to text command returns a Text value read from the BLOB blob.

The textFormat parameter fixes the internal format and character set of the text value to be read. In databases created beginning with version 11, 4D uses the Unicode character set (UTF8) by default for managing text. For the sake of compatibility, this command can be used to "force" conversion using the Mac Roman character set (used in previous versions of 4D). The character set is chosen via the textFormat parameter. To do this, pass one of the following constants (found in the"BLOB" theme) in the textFormat parameter:

ConstantTypeValue
Mac C stringLong Integer0
Mac Pascal stringLong Integer1
Mac Text with lengthLong Integer2
Mac Text without lengthLong Integer3
UTF8 C stringLong Integer4
UTF8 Text with lengthLong Integer5
UTF8 Text without lengthLong Integer6

Notes:

The "UTF8" constants can only be used when the application runs in Unicode mode.

The "Mac" constants cannot work with texts greater than 32 KB.

If you want to work with character sets other than UTF8, use the Convert to text command.

For more information about these constants and the formats they represent, please refer to the description of the TEXT TO BLOB command.

WARNING: The number of characters to be read is determined by the textFormat parameter, EXCEPT for the formats Mac Text without length andUTF8 Text without length, for which you MUST specify the number of characters to be read in the parameter textLength. For the other formats, textLength is ignored and you can omit it.

If you specify the optional offset variable parameter, the Text value is read at the offset (starting from zero) within the BLOB. If you do not specify the optional offset variable parameter, the beginning of the BLOB is read according to the value you pass in textFormat. Note that you must pass the offset variable parameter when you are reading text without length.

Note: You should pass an offset value between 0 (zero) and the size of the BLOB minus the size of the text to be read. If you do not do so, the function result is unpredictable.

After the call, the variable is incremented by the number of bytes read. Therefore, you can reuse that same variable with another BLOB reading command to read another value.

See Also

BLOB to integer, BLOB to longint, BLOB to real, INTEGER TO BLOB, LONGINT TO BLOB, REAL TO BLOB, TEXT TO BLOB.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next