IBM Books

Call Level Interface Guide and Reference

SQL to C Data Conversion Examples


Table 208. SQL to C Data Conversion Examples
SQL Data Type SQL Data Value C Data Type cbValueMax rgbValue SQL STATE
SQL_CHAR abcdef SQL_C_CHAR 7 abcdef\0 a 00000
SQL_CHAR abcdef SQL_C_CHAR 6 abcde\0 a 01004
SQL_DECIMAL 1234.56 SQL_C_CHAR 8 1234.56\0 a 00000
SQL_DECIMAL 1234.56 SQL_C_CHAR 5 1234\0 a 01004
SQL_DECIMAL 1234.56 SQL_C_CHAR 4 --- 22003
SQL_DECIMAL 1234.56 SQL_C_FLOAT ignored 1234.56 00000
SQL_DECIMAL 1234.56 SQL_C_SHORT ignored 1234 01004
SQL_DATE 1992-12-31 SQL_C_CHAR 11 1992-12-31\0 a 00000
SQL_DATE 1992-12-31 SQL_C_CHAR 10 --- 22003
SQL_DATE 1992-12-31 SQL_C_TIMESTAMP ignored 1992,12,31, 0,0,0,0 b 00000
SQL_TIMESTAMP 1992-12-31 23:45:55.12 SQL_C_CHAR 23 1992-12-31 23:45:55.12\0 a 00000
SQL_TIMESTAMP 1992-12-31 23:45:55.12 SQL_C_CHAR 22 1992-12-31 23:45:55.1\0 a 01004
SQL_TIMESTAMP 1992-12-31 23:45:55.12 SQL_C_CHAR 18 --- 22003
Note:
a
"\0" represents a null termination character.
b
The numbers in this list are the numbers stored in the fields of the TIMESTAMP_STRUCT structure.

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 ]