MDAC 2.5 SDK - OLE DB Programmer's Reference
Appendix A: Data Types


 

Conversions Involving PROPVARIANTs

The following table describes conversions to and from PROPVARIANTs. Type indicator X can be modified by DBTYPE_ARRAY or DBTYPE_BYREF. X is not DBTYPE_VARIANT. No conversions are supported when it is modified by DBTYPE_VECTOR.

Source type indicator Target type indicator Notes
X DBTYPE_PROPVARIANT If X is a valid PROPVARENUM value, the conversion library sets vt in the target PROPVARIANT to X and transfers the data to the corresponding element of the union.

If X is not a valid PROPVARENUM value and X is DBTYPE_STR or DBTYPE_WSTR, the conversion library sets vt in the target PROPVARIANT to VT_BSTR and transfers the data to the corresponding element of the union.

If X is not a valid PROPVARENUM value and X is DBTYPE_GUID, the conversion library sets vt in the target PROPVARIANT to VT_CLSID and transfers the data to the corresponding element of the union. The client application is responsible for freeing the memory allocated for VT_CLSID.

If X is not a valid PROPVARENUM value and X is DBTYPE_BYTES, the conversion library sets vt in the target PROPVARIANT to VT_BLOB and transfers the data to the corresponding element of the union. The client application is responsible for freeing the memory allocated for VT_BLOB.

DBTYPE_PROPVARIANT X If the type indicator specified in the source of PROPVARIANT is X, the conversion library transfers the data.

If the type indicator specified in the source of PROPVARIANT is not X and is a valid PROPVARENUM value, the conversion library will support the conversion as long as DBTYPE_(the type indicator of the source) -> DBTYPE_X is supported. VT_LPSTR will be treated the same as DBTYPE_STR | DBTYPE_BYREF, VT_LPWSTR as DBTYPE_WSTR | DBTYPE_BYREF, VT_CLSID as DBTYPE_GUID, and VT_BLOB as DBTYPE_BYTES.

DBTYPE_PROPVARIANT DBTYPE_PROPVARIANT The conversion library sets vt in the target PROPVARIANT to the same value as vt in the source DBPROPVARIANT. It transfers the data from the union element in the source VARIANT to the same element in the target PROPVARIANT.
DBTYPE_VARIANT DBTYPE_PROPVARIANT If the type indicator specified in the source of VARIANT is a valid PROPVARENUM value, the conversion library sets vt in the target PROPVARIANT to the type indicator of the source and transfers the data to the corresponding element of the union.
DBTYPE_PROPVARIANT DBTYPE_VARIANT If the type indicator specified in the source of PROPVARIANT is a valid VARENUM and PROPVARNUM value, the conversion library sets vt in the target VARIANT to the type indicator of the source and transfers the data to the corresponding element of the union.