다음을 통해 공유


CBulkRowset Class

Fetches and manipulates rows to work on data in bulk by retrieving multiple row handles with a single call.

template <class TAccessor>
class CBulkRowset : public CRowset<TAccessor>

Parameters

  • TAccessor
    An accessor class.

Members

Methods

AddRefRows

Increments the reference count.

CBulkRowset

Constructor.

MoveFirst

Retrieves the first row of data, performing a new bulk fetch if necessary.

MoveLast

Moves to the last row.

MoveNext

Retrieves the next row of data.

MovePrev

Moves to the previous row.

MoveToBookmark

Fetches the row marked by a bookmark or the row at a specified offset from that bookmark.

MoveToRatio

Fetches rows starting from a fractional position in the rowset.

ReleaseRows

Sets the current row (m_nCurrentRow) to zero and releases all rows.

SetRows

Sets the number of row handles to be retrieved by one call.

Example

The following example demonstrates use of the CBulkRowset class.

class CCustomerData
{
public:
   char m_szField1[50];

   BEGIN_COLUMN_MAP(CCustomerData)
     COLUMN_ENTRY(1, m_szField1)
   END_COLUMN_MAP()
};

void DoCBulkRowsetTest()
{
   CoInitialize(NULL);

   CCommand<CAccessor<CCustomerData>, CBulkRowset > cmd;
   CDataSource ds;

   // Open up data link dialogs to create a data source
   ds.Open();

   CSession session;
   session.Open(ds);
   // Could call SetRows() here if you want to fetch  
   // more than 10 HROWs at a time.
   cmd.Open(session, L"Select * from customer");
   cmd.MoveFirst();
   // Note that the CBulkRowset by default fetched 10 HROWs at a time  
   // so that the MoveNext call will not have to make the GetNextRows  
   // call to get the second HROW because it has already been fetched  
   //by the MoveFirst() call above.
   cmd.MoveNext();

   cmd.Close();
   session.Close();
   ds.Close();
}

Requirements

Header: atldbcli.h

See Also

Concepts

OLE DB Consumer Templates (C++)

OLE DB Consumer Templates Reference