SQL to C conversion for XML data

You can convert the XML SQL data type, SQL_XML, to a C data type.

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

Table 1. Conversion of XML SQL data to C data
fCType Test rgbValue pcbValue SQLSTATE
SQL_C_CHAR Data length < = cbValueMax Data Data length (in bytes) 000001
Data length > cbValueMax Truncated data Data length (in bytes) 01004
SQL_C_BINARY Data length < = cbValueMax Data Data length (in bytes) 000001
Data length > cbValueMax Truncated data Data length (in bytes) 01004
SQL_C_BINARYXML Data length < = cbValueMax Data Data length (in bytes) 000001
Data length > cbValueMax Truncated data Data length (in bytes) 01004
SQL_C_DBCHAR Number of double-byte characters * 2 < cbValueMax Data Data length (in bytes) 000001
Number of double-byte characters * 2 >= cbValueMax Truncated data, to the nearest even byte that is less than cbValueMax Data length (in bytes) 01004
SQL_C_WCHAR Number of double-byte characters * 2 < cbValueMax Data Data length (in bytes) 000001
Number of double-byte characters * 2 >= cbValueMax Truncated data, to the nearest even byte that is less than cbValueMax Data length (in bytes) 01004
Note:
  1. SQLSTATE 00000 is not returned by SQLGetDiagRec(), rather it is indicated when the function returns SQL_SUCCESS.