Use
Use in params and variables blocks to define the data type of a parameter or variable. The data type can be selected when defining fields, global variables, and component variables.
Description
Use the raw data type for fields containing raw data that should not be converted or processed, such as pictures and sound.
raw data is encoded as
UTF-8
.
No arithmetic operations can be applied to this kind of data.
It is not possible to directly compare two
parameters, variables, or fields that use the data type raw or
image—they will always evaluate to True
. An alternative is to
calculate and compare a hash of the data.
Raw data is not supported in Service Stored Procedures (SSP) for most databases. It is supported for SSP only on Sybase.
Comparing raw or image Data
You can calculate a hash of the data and compare the hash instead of the content. The following code checks whether two files are the same.
variables string vFile1Name, vFile2Name, vFile1MD5Hash, vFile2MD5Hash raw vFile1Raw, vFile2Raw numeric vFile1Size, vFile2Size endvariables ; Create a hash of lfileload/raw vFile1Name, vFile1Raw vFile1Size = $status vFile1MD5Hash = $encode("HEX", $encode("MD5", vFile1Raw)) lfileload/raw vFileName2, vFile2Raw vFile2Size = $status vFile2MD5Hash = $encode("HEX", $encode("MD5", vFile2Raw)) if (vFile1Size = vFile2Size & vFile1MD5Hash = vFile2MD5Hash) message/info "[%%vFile1Name] and [%%vFile2Name] are identical." else message/error "[%%vFile1Name] and [%%vFile2Name] are different!" endif