IDataConvert::GetConversionSize

OLE DB Programmer's Reference

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

HRESULT GetConversionSize (    DBTYPE       wSrcType,    DBTYPE       wDstType,    DBLENGTH *   pcbSrcLength,    DBLENGTH *   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.

Comments

The size of a fixed-width destination type can be discovered by passing a null pointer in the pSrc parameter. For example, the width of wType can be determined by adding the following code:

pConvert->GetConversionSize(wType, wType, 0, &ulWidth, 0);

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net