7.5.3.Data Types

Data Type Mappings in Rowsets and Parameters

The methods that provide information about rowset columns and command parameters (IColumnsInfo::GetColumnInfo, ICommandWithParameters::GetParameterInfo) use the mapping of Virtuoso data types into OLE DB data types shown in the following table.

Table7.18.Data Type Mappings

Virtuoso Type OLE DB Type
CHAR DBTYPE_STR
VARCHAR DBTYPE_STR
LONG VARCHAR DBTYPE_STR
NCHAR DBTYPE_WSTR
NVARCHAR DBTYPE_WSTR
LONG NVARCHAR DBTYPE_WSTR
NUMERIC DBTYPE_NUMERIC
DECIMAL DBTYPE_NUMERIC
SMALLINT DBTYPE_I2
INTEGER DBTYPE_I4
FLOAT DBTYPE_R8
DOUBLE DBTYPE_R8
REAL DBTYPE_R4
VARBINARY DBTYPE_BYTES
LONG VARBINARY DBTYPE_BYTES
DATE DBTYPE_DBDATE
TIME DBTYPE_DBTIME
DATETIME DBTYPE_DBTIMESTAMP
TIMESTAMP BINARY

Data Type Conversions

Applications can bind column and parameter values using data types different from those described in the section called “Data Type Mappings in Rowsets and Parameters” . In such cases VIRTOLEDB uses OLE DB Data Conversion Library. See MDAC documentation for the list of supported data type conversions.

Long Data Types

Long data types include LONG VARCHAR, LONG NVARCHAR, and LONG VARBINARY. A long value can only be bound to a buffer that have one of these OLE DB types:

  • DBTYPE_IUNKNOWN

  • DBTYPE_STR

  • DBTYPE_STR | DBTYPE_BYREF

  • DBTYPE_WSTR

  • DBTYPE_WSTR | DBTYPE_BYREF

  • DBTYPE_BYTES

  • DBTYPE_BYTES | DBTYPE_BYREF

Other type conversions are not supported.

If a long data is bound to a DBTYPE_IUNKNOWN type, this implies the use of the ISequentialStream interface. VIRTOLEDB supports the ISequentialStream::Read method both when getting and setting data. The ISequentialStream::Write method is never supported.