Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

IDSSTypeMapping Interface Reference

List of all members.

Detailed Description

This is the OLE automation compliant interface for data type mapping.

The first two methods provide conversion between database native data type and DSS internal data type in both directions. The remaining two methods are used to change the mapping between database native data type and DSS internal data type. It should be noted that when for mapping from native data type into DSS data type, the native data type may be in string or long integer format, depending on databases. This is because we use system catalog to retrieve appropriate data types. For details, refer to the design documentation of DSSDataType. In this interface, we use variant to support for multiple data type for the same interface method.


Public Member Functions

HRESULT ConvertDSSToNative ([in] IDSSDataType *pDataType,[in] Int32 DbType,[in, defaultvalue(0)] Int32 DbVersion,[out, retval] BSTR *pNativeType)
 Convert DSS data type to native type Given a DSS data type, return database native data type (in string format).
HRESULT ConvertNativeToDSS ([in] VARIANT NativeType,[in] Int32 Precision,[in] Int32 Scale,[in] IDSSDataType *pDataType,[in] Int32 DbType,[in, defaultvalue(0)] Int32 DbVersion)
 Convert native type to DSS data type Given a database native data type, return its corresponding DSS data type (by setting its values through IDSSDataType interface).
HRESULT SetDSSToNative ([in] IDSSDataType *pDataType,[in] BSTR NativeType,[in] Int32 DbType,[in, defaultvalue(0)] Int32 DbVersion)
 Change mapping from DSS data type to native type Given a DSS type and its corresponding database native data type, change internal mapping.
HRESULT SetNativeToDSS ([in] VARIANT NativeType,[in] Int32 Precision,[in] Int32 Scale,[in] IDSSDataType *pDataType,[in] Int32 DbType,[in, defaultvalue(0)] Int32 DbVersion)
 Change mapping from native type to DSS data type Given a database native data type and its corresponding DSS type, change the internal mapping.


Member Function Documentation

HRESULT IDSSTypeMapping::ConvertDSSToNative [in] IDSSDataType pDataType,
[in] Int32  DbType,
[in, defaultvalue(0)] Int32  DbVersion,
[out, retval] BSTR *  pNativeType
 

Convert DSS data type to native type Given a DSS data type, return database native data type (in string format).

Parameters:
pDataType A point to IDSSDataType interface.
DbType Database type.
DbVersion Database version.
pNativeType returns native data type in string format.
Returns:
Usual COM result code:
  • S_OK Conversion succeeded.
  • S_FALSE Conversion failed.

HRESULT IDSSTypeMapping::ConvertNativeToDSS [in] VARIANT  NativeType,
[in] Int32  Precision,
[in] Int32  Scale,
[in] IDSSDataType pDataType,
[in] Int32  DbType,
[in, defaultvalue(0)] Int32  DbVersion
 

Convert native type to DSS data type Given a database native data type, return its corresponding DSS data type (by setting its values through IDSSDataType interface).

Parameters:
NativeType Variant type to store native data type, must be either BSTR (VT_BSTR) or long (VT_I4)
Precision Indicate the precision of the native data type, it could be number of digits in case of DECIMAL, or number of bytes in case of CHAR. A value of 0 indicates that either this data type does not come with precision (so we should use default value), or it simply does not have a precision.
Scale Only used for data type such as DECIMAL, to describe the number of digits after the decimal point. Since a valid scale value could be 0 or even negative, we use value 0x80000000 to indicate a NULL scale.
pDataType A point to IDSSDataType interface
DbType Database type
DbVersion Database version
Returns:
Usual COM result code:
  • S_OK Conversion succeeded.
  • S_FALSE Conversion failed.

HRESULT IDSSTypeMapping::SetDSSToNative [in] IDSSDataType pDataType,
[in] BSTR  NativeType,
[in] Int32  DbType,
[in, defaultvalue(0)] Int32  DbVersion
 

Change mapping from DSS data type to native type Given a DSS type and its corresponding database native data type, change internal mapping.

Parameters:
pDataType A point to IDSSDataType interface, from which we can retrieve three values, a type, a precision and a scale. The type holds the internal DSS data type. The other two parameters are also useful. Precision indicates the maximum precision this data type can hold without overflow. Scale is used to indicate the action taken when overflow occurs. If Scale is 0, an overflow error is reported. Otherwise scale should be another DSSDataType values to indicate the use of alternative mapping when overflow occurs.
NativeType A string pattern for the native data type that corresponds to the internal DSS data type. We use special placeholder string #p and #s to indicate the position in the pattern to put precision and scale, respectively. A valid example string pattern could be: DECIMAL(#p, #s). Must use small case in #p and #s.
DbType Database type
DbVersion Database version
Returns:
Usual COM result code:
  • S_OK Set succeeded.
  • S_FALSE Set failed.

HRESULT IDSSTypeMapping::SetNativeToDSS [in] VARIANT  NativeType,
[in] Int32  Precision,
[in] Int32  Scale,
[in] IDSSDataType pDataType,
[in] Int32  DbType,
[in, defaultvalue(0)] Int32  DbVersion
 

Change mapping from native type to DSS data type Given a database native data type and its corresponding DSS type, change the internal mapping.

Parameters:
NativeType Variant type to store native data type, must be either BSTR (VT_BSTR) or long (VT_I4)
Precision Indicate the default precision of the native data type, it could be number of digits in case of DECIMAL, or number of bytes in case of CHAR. A value of 0 indicates that either this data type does not have a default precision.
Scale Indicate the default scale of the native data type. Only used for data type such as DECIMAL to describe the number of digits after the decimal point. A value of 0x80000000 indicate a NULL scale (no default scale or no scale for this data type).
pDataType A point to IDSSDataType interface, holding corresponding DSS data type.
DbType Database type
DbVersion Database version
Returns:
Usual COM result code:
  • S_OK Set succeeded.
  • S_FALSE Set failed.


Copyright © 1996-2018 MicroStrategy Inc. All Rights Reserved.