Contents SAS IOM Data Provider Previous Next

ISASColumnsInfo

The ISASColumnsInfo interface augments the standard OLE DB IColumnsInfo method.  Its single method returns SAS specific column metadata that does not directly map to OLE DB constructs.

MethodDescription
GetColumnInfoReturns SAS specific column metadata.

ISASColumnsInfo::GetColumnInfo

Returns the SAS column metadata that is not supported by IColumnsInfo::GetColumnsInfo.

HRESULT GetColumnInfo(
        ULONG *                 pcColumns,
        SASCOLUMNINFO **        prgInfo,
        OLECHAR **              ppStringsBuffer );

Parameters

pcColumns
[out]
pointer to memory to which the number of columns in the rowset is returned; this number will NOT include the bookmark column even if there is one. If this method terminates due to an error, *pcColumns is set to zero.
prgInfo
[out]
pointer to memory to which an array of SASCOLUMNINFO structures is returned. One structure is returned for each column that is in the rowset. The provider allocates memory for the structures and returns the address to this memory; the user releases this memory with IMalloc::Free when the memory is no longer needed by the column information. If *pcColumns is 0 on output or terminates due to an error, the provider does not allocate any memory and ensures that *prgInfo is a null pointer on output. For more information, see the following SASCOLUMNINFO Structure section.

ppStringsBuffer
[out]
pointer to memory to which a pointer is returned to storage for all string values that are within a single allocation block. If no returned columns have string names, or if this method terminates due to error, this parameter returns a null pointer. If there are any strings, then this will be a buffer that contains all the values of those strings. The user should free the buffer with IMalloc::Free when finished working with the names. If *pcColumns is zero on output, the provider does not allocate any memory and ensures that *ppStringsBuffer is a null pointer on output. Each of the individual string values stored in this buffer is terminated by a null-termination character.

Return Codes

S_OK
indicates that the method succeeded.
E_FAIL
indicates that a provider-specific error occurred.
E_INVALIDARG
indicates that pcColumns, prgInfo, or ppStringsBuffer was a null pointer.
E_OUTOFMEMORY
indicates that the provider was unable to allocate sufficient memory in which to return the column information structures.

Details

This method makes no logical change to the state of the object.

GetColumnInfo returns a fixed set of column metadata in an array of SASCOLUMNINFO structures, one per column.

The order of the structures is the order in which the columns appear in the rowset (column ordinal order). This is the same order in which they are returned from IColumnsInfo::GetColumInfo.

Bookmark columns are not included in the output of this method. Only the self bookmark column is supported by this provider and the SAS-specific column metadata returned by this provider does not apply.

SASCOLUMNINFO Structure

GetColumnInfo returns column metadata in SASCOLUMNINFO structures.

typedef struct tagSASCOLUMNINFO {
        LPOLESTR pwszColDesc;
        LPOLESTR pwszFmtName;
        LPOLESTR pwszIFmtName;
        ULONG iOrdinal;
        SHORT iFmtLength;
        SHORT iFmtDecimal;
        SHORT iIFmtLength;
        SHORT iIFmtDecimal;
        SHORT iSortInfo;
        BOOL fIndexed;
} SASCOLUMNINFO;

The elements of this structure are as follows:

ElementDescription
pwszColDescPointer to the column description (otherwise known as the SAS variable label).  If no label is associated with this column, this member is NULL.
pwszFmtNamePointer to the persisted format name. If no format is associated with this column, this member is NULL.
pwszIFmtNamePointer to the persisted informat name. If no informat is associated with this column, this member is NULL.
iOrdinalThe ordinal of the column. This corresponds to the SAS variable number.
iFmtLengthThe width of the formatted data. This member is only valid when pwszFmtName is non-null.
iFmtDecimalThe decimal width of the format data. This member is only valid when pwszFmtDecimal is non-null.
iIFmtLengthThe width of the informatted data. This member is only valid when pwszIFmtName is non-null.
iIFmtDecimalThe decimal width of the informatted data. This member is only valid when pwszIFmtName is non-null.
iSortInfoA signed short value that indicates this column's position in any applied sort key. Positive values indicate ascending sort order and negative values indicate descending sort order. The absolute value of the key location describes the position of the variable in the sort key. Zero (0) indicates that the column does not participate in the sort key.

For the SAS IOM provider, this member is not valid.  That is, it always contains zero whether the column participates in the sort key. 

fIndexed

True when this column is indexed.

 

Contents SAS IOM Data Provider Previous Next