IBM Books

Call Level Interface Guide and Reference

Converting Character SQL Data to C Data

The character SQL data types are:

SQL_CHAR
SQL_VARCHAR
SQL_LONGVARCHAR
SQL_CLOB

Table 201. Converting Character SQL Data to C Data
fCType Test rgbValue pcbValue SQLSTATE
SQL_C_CHAR Length of data < cbValueMax Data Length of data 00000
Length of data >= cbValueMax Truncated data Length of data 01004
SQL_C_BINARY Length of data <= cbValueMax Data Length of data 00000
Length of data > cbValueMax Truncated data Length of data 01004
SQL_C_SHORT 
SQL_C_LONG
SQL_C_FLOAT
SQL_C_FLOAT
SQL_C_TINYINT
SQL_C_BIT

Data converted without truncation a Data Size of the C data type
00000 

Data converted with truncation, but without loss of significant digits a Data Size of the C data type 01004
Conversion of data would result in loss of significant digitsa Untouched Size of the C data type 22003
Data is not a number a Untouched Size of the C data type 22005
SQL_C_DATE Data value is a valid date a Data 6 b 00000
Data value is not a valid date a Untouched 6 b 22007
SQL_C_TIME Data value is a valid time a Data 6 b 00000
Data value is not a valid time a Untouched 6 b 22007
SQL_C_TIMESTAMP Data value is a valid timestamp a Data 16 b 00000
Data value is not a valid timestamp a Untouched 16 b 22007
Note:
a
The value of cbValueMax is ignored for this conversion. The driver assumes that the size of rgbValue is the size of the C data type.
b
This is the size of the corresponding C data type.

SQLSTATE 00000 is not returned by SQLError(), rather it is indicated when the function returns SQL_SUCCESS.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]