IDataConvert::GetConversionSize

Calculates the size of the buffer needed by the destination data type to support a conversion.

HRESULT GetConversionSize (
   DBTYPE    wSrcType,
   DBTYPE    wDstType,
   ULONG *   pcbSrcLength,
   ULONG *   pcbDstLength,
   void *    pSrc);

Parameters

wSrcType

[in]
The source type of the data.

wDstType

[in]
The destination type of the data.

pcbSrcLength

[in]
A pointer to the length of the source data, in bytes. This value can be a null pointer.

pcbDstLength

[out]
A pointer to memory in which to return the size of the destination buffer required for the conversion, in bytes.

pSrc

[in]
A pointer to the source data.

Return Code

S_OK
The method succeeded.

E_FAIL
A provider-specific error occurred.

E_INVALIDARG
pcbDstLength was a null pointer or the information supplied by the consumer was insufficient to determine the appropriate buffer size.

pcbSrcLength was a null pointer and the conversion size was requested for a conversion from a variable-length data type to DBTYPE_STR, DBTYPE_WSTR, DBTYPE_BSTR, or DBTYPE_VARIANT.

DB_E_UNSUPPORTEDCONVERSION
The requested conversion was not supported.