SQLDA extension for binary XML data

Although there is no embedded SQL support for binary XML host variables, it is possible to set up an SQLDA to indicate that XML data is XML binary data.

Begin program-specific programming interface information.

For OPEN, EXECUTE, FETCH, and CALL statements, the application program sets the fields in the SQLDA to provide Db2 with information about input or output host variables in the application program.

To describe a binary XML host variable, the SQLDA has the following format and content:

  • A binary XML host variable that is not a file reference variable requires an SQLDA with two sets of SQLVARs.
  • In a base SQLVAR, the SQLTYPE field is set to BLOB (404/405) and the SQLLEN field is set to 0
  • The SQLNAME field of the base SQLVAR is set as follows: The length of SQLNAME is 8. The first four bytes of the data portion of SQLNAME are X'00000000'. The fifth byte is a flag field that indicates the type of host variable. The values of this field are as follows:
    • X'01'- XML variables (XML AS BLOB, XML AS CLOB, XML AS DBCLOB)
    • X'03'- binary XML variables

There is no change to the sixth to eighth of the SQLNAME field of the base SQLVAR

  • In an extended SQLVAR, the SQLLONGLEN field is set to the length attribute of a binary XML variable.

To describe a binary XML file, the file reference variable only requires an SQLDA with one set of SQLVARs. The SQLTYPE field of a base SQLVAR is set to BLOB_FILE (916/917). The SQLNAME field of base SQLVAR is set to the same value as that of a binary XML variable.

There is no change to the output SQLDA for DESCRIBE and PREPARE INTO statements.

The binary XML bits on the host variables of all other data types are ignored.

End program-specific programming interface information.