Datatype mappings

The following table describes the ASE ODBC Driver datatype mappings.

Table 1-1: Datatype mappings

ASE datatype

ODBC SQL type

ODBC bind type

binary

SQL_BINARY

SQL_C_BINARY

bit

SQL_BIT

SQL_C_BIT

char

SQL_CHAR

SQL_C_CHAR

date

SQL_TYPE_DATE

SQL_C_TYPE_DATE or SQL_C_CHAR

datetime

SQL_TYPE_TIMESTAMP

SQL_C_TYPE_TIMESTAMP or SQL_C_CHAR

decimal

SQL_DECIMAL

SQL_C_NUMERIC or SQL_C_CHAR

double

SQL_DOUBLE

SQL_C_DOUBLE

float(<16)

SQL_REAL

SQL_C_FLOAT

float(>=16)

SQL_DOUBLE

SQL_C_DOUBLE

image

SQL_LONGVARBINARY

SQL_C_BINARY

int[eger]

SQL_INTEGER

SQL_C_LONG

money

SQL_DECIMAL

SQL_C_NUMERIC or SQL_C_CHAR

nchar

SQL_CHAR

SQL_C_CHAR

nvarchar

SQL_VARCHAR

SQL_C_CHAR

numeric

SQL_NUMERIC

SQL_C_NUMERIC or SQL_C_CHAR

real

SQL_REAL

SQL_C_FLOAT

smalldatetime

SQL_TYPE_TIMESTAMP

SQL_C_TYPE_TIMESTAMP or SQL_C_CHAR

smallint

SQL_SMALLINT

SQL_C_SHORT

smallmoney

SQL_DECIMAL

SQL_C_NUMERIC or SQL_C_CHAR

text

SQL_LONGVARCHAR

SQL_C_CHAR

time

SQL_TYPE_TIME

SQL_C_TYPE_TIME or SQL_C_CHAR

timestamp

SQL_BINARY

SQL_C_BINARY

tinyint

SQL_TINYINT

SQL_C_TINYINT

unichar

SQL_WCHAR

SQL_C_CHAR

univarchar

SQL_WVARCHAR

SQL_C_CHAR

varbinary

SQL_VARBINARY

SQL_C_BINARY

varchar

SQL_VARCHAR

SQL_C_CHAR

Special instructions for unichar and varchar

When you use the ASE datatypes unichar and univarchar, and bind either of them to SQL_C_CHAR, in Linux and Mac, the ASE ODBC Driver needs to convert the data from Unicode to multibyte and vice versa. For this conversion, it needs to have the SYBASE charsets installed in the $SYBASE directory. The installation program for Linux includes an option to install these charset files. For Mac OS X, they are installed by default.

NoteIf the driver does not find the charsets or if the $SYBASE environment variable is not set, then an appropriate error is propagated to the application. To install the SYBASE charsets you must reinstall the ODBC Driver. See the Software Developer’s Kit and Open Server 12.5.1 Installation Guide for installation information.