Mapping datatypes

The following table describes the ASE OLE DB Provider datatype mappings.

Table 1-2: ASE datatypes and OLE DB datatypes

ASE datatype

OLE DB datatype

C++ datatype

binary

DBTYPE_BYTES

unsigned char[]

bigint

DBTYPE_I8

long long

bit

DBTYPE_BOOL

BOOL

char

DBTYPE_STR, DBTYPE_BSTR

char[], BSTR

date

DBTYPE_DBDATE

DATE_STRUCT

datetime

DBTYPE_DBTIMESTAMP

TIMESTAMP_STRUCT

decimal

DBTYPE_DECIMAL

SQL_NUMERIC

double

DBTYPE_R8

double

float(<16)

DBTYPE_R4

float

float(>=16)

DBTYPE_R8

double

image

DBTYPE_IUNKNOWN, DBTYPE_BYTES

IUnknown, unsigned char[]

NoteSybase recommends that you use streams through IUnknown interfaces. It can also be bound as unsigned char[].

int[eger]

DBTYPE_I4

long

money

DBTYPE_CY

long long

nchar

DBTYPE_STR, DBTYPE_BSTR

char[], BSTR

numeric

DBTYPE_NUMERIC

SQL_NUMERIC

nvarchar

DBTYPE_STR, DBTYPE_BSTR

char[], BSTR

real

DBTYPE_R4

float

smalldatetime

DBTYPE_DBTIMESTAMP

TIMESTAMP_STRUCT

smallint

DBTYPE_I2

short

smallmoney

DBTYPE_CY

long long

text

DBTYPE_IUNKNOWN, DBTYPE_STR

IUnknown, char[]

NoteSybase recommends that you use streams through IUnknown interfaces. It can also be bound as char[].

time

DBTYPE_DBTIME

TIME_STRUCT

timestamp

DBTYPE_BYTES

unsigned char[]

tinyint

DBTYPE_UI1

unsigned char

unichar

DBTYPE_WSTR, DBTYPE_BSTR

wchar_t[], BSTR

unitext

DBTYPE_IUNKNOWN, DBTYPE_WSTR

IUnknown, wchar_t[]

NoteSybase recommends that you use IUnknown.

univarchar

DBTYPE_WSTR, DBTYPE_BSTR

wchar_t[], BSTR

unsignedbigint

DBTYPE_UI8

unsigned long long

unsignedint

DBTYPE_UI4

unsigned long

unsignedsmallint

DBTYPE_UI2

unsigned short

varbinary

DBTYPE_BYTES

unsigned char[]

varchar

DBTYPE_STR, DBTYPE_BSTR

char[], BSTR