Hi Vincent

Although updating the documentation will help, it is not going to resolve the issue here and possibly other issues using Unicode strings.

Having the documentation to say not to use varchar(max) and/or CLOB, with SQLFetchResultsetValues and SQLFetchRowValues, is not going to resolve binary columns used within these routines.

In the past (DF19 or less), there were constraints around the string argument size hence probably why the 16KB limit was used, and also you could move binary columns to a string.

In DF23, there are no constraints on argument size but a big no-no with moving binary data to strings - runtime errors should be raised for theses.

Therefore, columns of type varchar(max), CLOB, BLOB, varbinary(max) and binary need to be treated differently and with care.


My suggestions are:


Option 1 (minimum change)


  1. Update documentation to say BLOB and BINARY columns not supported, and only the first 16KB of CLOB are supported.
    • Best to use SQLGetData or SQLGetDataToUChar instead

  2. If any returned aSQLColumns[x].iSQLType has a binary typed column then raise a runtime error.
  3. For all varchar aSQLColumns[x].iVariableDataType columns, retrieve 16KB + 1 byte instead of 16KB
    • if the retrieved data is greater than 16KB then raise a runtime error
    • else it would work as it is


Option 2 (Better option)


  1. Update documentation to say BLOB and BINARY columns are not supported
    • Best to use SQLGetDataToUChar instead

  2. If any returned aSQLColumns[x].iSQLType has a binary typed column then raise a runtime error.
  3. For all varchar aSQLColumns[x].iVariableDataType columns, loop to retrieve all data using 16KB chunks



Option 3 (Maybe)


  1. Update documentation to say BLOB and BINARY columns will be returned as HEX String
    • Best to use SQLGetDataToUChar instead

  2. For all returned aSQLColumns[x].iSQLType has a binary typed column
    • Retrieve all data in 16KB chunks using SQLGetDataToUChar
    • Convert UChar[] to Hex String

  3. For all varchar aSQLColumns[x].iVariableDataType columns, loop to retrieve all data using 16KB chunks




Just my 2 cents