IPB_ResultSetAccessor interface

Description

The IPB_ResultSetAccessor interface is used to access result sets in DataWindow and DataStore objects.

Methods

The IPB_ResultSetAccessor interface has six methods:

AddRef

GetColumnCount

GetColumnMetaData

GetItemData

GetRowCount

Release

AddRef

Description

When you call the CreateResultSet function of interface IPB_Session, you need to pass an argument of type IPB_ResultSetAccessor. The AddRef function is called on that argument and the Release function is called when the pbobject is destroyed.

Syntax

AddRef ( )

Return value

None.

See also

CreateResultSet

GetColumnCount

GetColumnCount

Description

Obtains the number of columns.

Syntax

GetColumnCount ( )

Return value

Unsigned long.

Examples

This statement stores the number of columns in *numCols:

*numCols = d_rsAccessor->GetColumnCount();

See also

CreateResultSet

GetRowCount

GetColumnMetaData

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 value

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

CreateResultSet

GetColumnCount

GetItemData

GetRowCount

GetItemData

Description

Accesses the data in a cell. The first row is 1 and the first column is 1.

Syntax

GetItemData(unsigned long row, unsigned long col, IPB_RSItemData* data)

Argument

Description

row

The row number of the cell

col

The column number of the cell

data

A pointer to an IPB_RSItemData structure


Return value

Boolean.

Examples

This example stores the data in the first row and column in the IPB_RSItemData structure sd:

d_rsAccessor->GetItemData(1, 1, &sd);

Usage

If the value of data is null, this function issues the callback data->SetNull. If the value is not null, it issues the callback data->SetData. For more information, examine the IPB_RSItemData interface.

See also

CreateResultSet

GetColumnCount

GetColumnMetaData

GetRowCount

IPB_RSItemData interface

SetData

SetNull

GetRowCount

Description

Obtains the number of rows.

Syntax

GetRowCount ( )

Return value

Unsigned long.

Examples

This statement stores the number of rows in *numRows:

*numRows = d_rsAccessor->GetRowCount();

See also

CreateResultSet

GetColumnCount

GetColumnMetaData

GetItemData

Release

Description

When you call the CreateResultSet function of interface IPB_Session, you need to pass an argument of type IPB_ResultSetAccessor. The AddRef function is called on that argument and the Release function is called when the pbobject is destroyed.

Syntax

Release ( )

Return value

None.

See also

AddRef

CreateResultSet