The following table illustrates how driver maps the server data types to default SQL and C data types:
Native Value | SQL Type | C Type |
bit |
SQL_BIT |
SQL_C_BIT |
tinyint |
SQL_TINYINT |
SQL_C_STINYINT |
tinyint unsigned |
SQL_TINYINT |
SQL_C_UTINYINT |
bigint |
SQL_BIGINT |
SQL_C_SBIGINT |
bigint unsigned |
SQL_BIGINT |
SQL_C_UBIGINT |
long varbinary |
SQL_LONGVARBINARY |
SQL_C_BINARY |
blob |
SQL_VARBINARY |
SQL_C_BINARY |
longblob |
SQL_VARBINARY |
SQL_C_BINARY |
tinyblob |
SQL_BINARY |
SQL_C_BINARY |
mediumblob |
SQL_LONGVARBINARY |
SQL_C_BINARY |
long varchar |
SQL_LONGVARCHAR |
SQL_C_CHAR |
text |
SQL_LONGVARCHAR |
SQL_C_CHAR |
mediumtext |
SQL_LONGVARCHAR |
SQL_C_CHAR |
char |
SQL_CHAR |
SQL_C_CHAR |
numeric |
SQL_NUMERIC |
SQL_C_CHAR |
decimal |
SQL_DECIMAL |
SQL_C_CHAR |
integer |
SQL_INTEGER |
SQL_C_SLONG |
integer unsigned |
SQL_INTEGER |
SQL_C_ULONG |
int |
SQL_INTEGER |
SQL_C_SLONG |
int unsigned |
SQL_INTEGER |
SQL_C_ULONG |
mediumint |
SQL_INTEGER |
SQL_C_SLONG |
mediumint unsigned |
SQL_INTEGER |
SQL_C_ULONG |
smallint |
SQL_SMALLINT |
SQL_C_SSHORT |
smallint unsigned |
SQL_SMALLINT |
SQL_C_USHORT |
real |
SQL_FLOAT |
SQL_C_DOUBLE |
double |
SQL_FLOAT |
SQL_C_DOUBLE |
float |
SQL_REAL |
SQL_C_FLOAT |
double precision |
SQL_DOUBLE |
SQL_C_DOUBLE |
date |
SQL_DATE |
SQL_C_DATE |
time |
SQL_TIME |
SQL_C_TIME |
year |
SQL_SMALLINT |
SQL_C_SHORT |
datetime |
SQL_TIMESTAMP |
SQL_C_TIMESTAMP |
timestamp |
SQL_TIMESTAMP |
SQL_C_TIMESTAMP |
text |
SQL_VARCHAR |
SQL_C_CHAR |
varchar |
SQL_VARCHAR |
SQL_C_CHAR |
enum |
SQL_VARCHAR |
SQL_C_CHAR |
set |
SQL_VARCHAR |
SQL_C_CHAR |
bit |
SQL_CHAR |
SQL_C_CHAR |
bool |
SQL_CHAR |
SQL_C_CHAR |
This is a translation of the MySQL Reference Manual that can be found at dev.mysql.com. The original Reference Manual is in English, and this translation is not necessarily as up to date as the English version.