C type identifier | ODBC C typedef | C type |
SQL_C_CHAR | SQLCHAR * | unsigned char * |
SQL_C_SSHORT | SQLSMALLINT | short int |
SQL_C_USHORT | SQLUSMALLINT | unsigned short int |
SQL_C_SLONG | SQLINTEGER | long int |
SQL_C_ULONG | SQLUINTEGER | unsigned long int |
SQL_C_FLOAT | SQLREAL | float |
SQL_C_DOUBLE | SQLDOUBLE, SQLFLOAT | double |
SQL_C_BIT | SQLCHAR | unsigned char |
SQL_C_STINYINT | SQLSCHAR | signed char |
SQL_C_UTINYINT | SQLCHAR | unsigned char |
SQL_C_SBIGINT | SQLBIGINT | _int64 |
SQL_C_UBIGINT | SQLUBIGINT | unsigned _int64 |
SQL_C_BINARY | SQLCHAR * | unsigned char * |
SQL_C_XML | SQLCHAR * | unsigned char * |
SQL_C_BOOKMARK | BOOKMARK | unsigned long int |
SQL_C_VARBOOKMARK | SQLCHAR * | unsigned char * |
SQL_C_TYPE_DATE | SQL_DATE_STRUCT | struct tagDATE_STRUCT { SQLSMALLINT year; SQLUSMALLINT month; SQLUSMALLINT day; } DATE_STRUCT; |
SQL_C_TYPE_TIME | SQL_TIME_STRUCT | struct tagTIME_STRUCT |
SQL_C_TYPE_TIMESTAMP | SQL_TIMESTAMP_STRUCT | struct tagTIMESTAMP_STRUCT |
SQL_C_NUMERIC | SQL_NUMERIC_STRUCT | struct tagSQL_NUMERIC_STRUCT |
SQL_C_GUID | SQLGUID | struct tagSQLGUID { |
All C interval data types | SQL_INTERVAL_STRUCT | See the "C Interval Structure" section, later in this appendix. |
使用ODBC访问数据库(二)
最新推荐文章于 2024-03-04 11:44:10 发布
使用C/C++语言开发,那么必定会在与ODBC语言间存在数据的转换的问题,因为ODBC所存在的一些数据类型在C语言中是不存在的。所以在ODBC的开发过程中不要使用int,float之类的C语言的实际类型来定义变量而应该使用ODBC定义的数据类型来定义变量,如SQLINTEGER,SQLFLOAT。在ODBC以宏定义的方式定义了C语言和ODBC中使用的数据类型: