SQL to C conversion for binary data

You can convert binary SQL data types to C data types. The binary SQL data types are SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY, and SQL_BLOB.

The following table shows information about converting binary SQL data to C data.

Table 1. Conversion of binary SQL data to C data
fCType Test rgbValue pcbValue SQLSTATE
  • SQL_C_CHAR
  • SQL_C_WCHAR
(Data length) < cbValueMax Data Data length (in bytes)1 N/A
(Data length) >= cbValueMax Truncated data Data length (in bytes) 01004
SQL_C_BINARY Data length <= cbValueMax Data Data length (in bytes) N/A
Data length > cbValueMax Truncated data Data length (in bytes) 01004
Note:
  1. For the SQL_C_WCHAR data type, the data length is the number of bytes of UCS-2 Unicode data.