OLE DB Rowset and Binding Support

To set and retrieve data, OLE DB Templates use an accessor and a rowset through the CAccessorRowset class, as shown in the following figure. This class can handle multiple accessors of different types.

Accessor Types

All accessors derive from CAccessorBase. CAccessorBase provides both parameter and column binding.

There are four accessor types and three rowset types, which are shown in the following figure.

  • CAccessor   Use this accessor when you know the structure of the database source at design time. CAccessor statically binds a database record, which contains the buffer, to the data source.

  • CDynamicAccessor   Use this accessor when you do not know the structure of the database at design time. CDynamicAccessor calls to get the database column information. It creates and manages an accessor and the buffer.

  • CDynamicParameterAccessor   Use this accessor to handle unknown command types. When you prepare the commands, CDynamicParameterAccessor can get parameter information from the interface, if the provider supports ICommandWithParameters.

  • CManualAccessor   With this class, you can use whatever data types you want as long as the provider can convert the type. It handles both result columns and command parameters.

The following table summarizes the four accessor types.

Accessor type Dynamic Params Buffer Multiple accessors
CAccessor No Yes User Yes
CDynamicAccessor Yes No OLE DB Templates No
CDynamicParameterAccessor Yes Yes OLE DB Templates No
CManualAccessor Yes Yes User No

Rowset Types

The OLE DB Templates support three kinds of rowsets (see the preceding figure): single rowsets (implemented by CRowset), bulk rowsets (implemented by CBulkRowset), and array rowsets (implemented by CArrayRowset). Single rowsets fetch a single row handle when MoveNext is called. Bulk rowsets can fetch multiple row handles. Array rowsets are rowsets that can be accessed using array syntax.

Back to the OLE DB Consumer Template Architecture