IPB_ResultSetAccessor interface:
GetColumnMetaData method
Description
Obtains a column's metadata. The column number of
the first column is 1. Memory must be allocated for columnName before
this function call. The pointer values can be null.
Syntax
GetColumnMetaData (unsigned long columnNum, LPTSTR columnName, pbvalue_type* type, unsigned long* width )
Argument
|
Description
|
columnNum
|
The number of the column for which you
want to obtain metadata
|
columnName
|
The name of the specified column
|
type
|
A pointer to the type of the specified
column
|
width
|
A pointer to the width of the specified
column
|
Return Values
None.
Examples
This example gets the number of columns in a result
set and allocates an array to hold the types of each column:
CRsltSet::CRsltSet(IPB_ResultSetAccessor* rsAccessor)
:m_lRefCount (0), d_rsAccessor(rsAccessor)
{
rsAccessor->AddRef();
// for each column
ULONG nNumColumns = d_rsAccessor->GetColumnCount();
d_arrColTypes = new USHORT[nNumColumns + 1];
for (ULONG nColumn=1; nColumn <= nNumColumns;
++nColumn)
{
// get the column type into the array
pbvalue_type type;
d_rsAccessor->GetColumnMetaData (nColumn,
NULL, &type, NULL);
d_arrColTypes[nColumn] = (USHORT)type;
}
}
See Also