Convert data from SQL to C
When you call SQLExtendedFetch, SQLFetch, or SQLGetData, HCL OneDB™ ODBC Driver retrieves data from a data source.
If necessary, HCL OneDB ODBC Driver converts the data from the source data type to the data type that the TargetType argument in SQLBindCol or the fCType argument in SQLGetData specifies. Finally, HCL OneDB ODBC Driver stores the data in the location pointed to by the rgbValue argument in SQLBindCol or SQLGetData.
The tables in the following sections describe how HCL OneDB ODBC Driver converts data that it retrieves from a data source. For a given HCL OneDB ODBC Driver SQL data type, the first column of the table lists the legal input values of the TargetType argument in SQLBindCol and the fCType argument in SQLGetData. The second column lists the outcomes of a test, often by using the cbValueMax argument specified in SQLBindCol or SQLGetData, which HCL OneDB ODBC Driver performs to determine whether it can convert the data. For each outcome, the third and fourth columns list the values of the rgbValue and pcbValue arguments specified in SQLBindCol or SQLGetData after HCL OneDB ODBC Driver tries to convert the data.
The last column lists the SQLSTATE returned for each outcome by SQLExtendedFetch, SQLFetch, or SQLGetData.
If the TargetType argument in SQLBindCol or the fCType argument in SQLGetData contains a value for the HCL OneDB ODBC Driver C data type that is not shown in the table for a given HCL OneDB ODBC Driver SQL data type, SQLExtendedFetch, SQLFetch, or SQLGetData returns SQLSTATE 07006 (Restricted data type attribute violation). If the fCType argument or the TargetType argument contains a value that specifies a conversion from a driver-specific SQL data type to the HCL OneDB ODBC Driver C data type and HCL OneDB ODBC Driver does not support this conversion, then SQLExtendedFetch, SQLFetch, or SQLGetData returns SQLSTATE S1C00 (Driver not capable).
Although the tables in this chapter do not show it, the pcbValue argument contains SQL_NULL_DATA when the SQL data value is null. When HCL OneDB ODBC Driver converts SQL data to character C data, the character count returned in pcbValue does not include the null-termination byte. If rgbValue is a null pointer, SQLBindCol or SQLGetData returns SQLSTATE S1009 (Invalid argument value).
- Length of data
- The number of bytes of C data that are available to return in rgbValue, regardless of whether the data is truncated before it returns to the application. For string data, this does not include the null-termination byte.
- Display size
- Total number of bytes that are needed to display the data in character format.
- Words in italics
- Represent function arguments or elements of the HCL OneDB ODBC Driver SQL grammar.