Rowsets are the central object that enables all OLE DB data providers to expose data in tabular form. Conceptually, a rowset is a set of rows in which each row has columns of data. Base table providers present their data in the form of rowsets. Query processors present the result of queries in the form of rowsets. This makes it possible to layer components that consume or produce data through the same object.
The most basic rowset object exposes four interfaces.
Interface | Used for |
IRowset | Contains methods for fetching rows in the rowset sequentially. |
IAccessor | Permits the definition of groups of column bindings describing the way tabular data is bound to consumer program variables. |
IColumnsInfo | Provides information about the columns of the rowset. |
IRowsetInfo | Provides information about the rowset itself. |
By using IRowset, a consumer can sequentially traverse the rows in the rowset, including traversing backward if the rowset supports it. The figure illustrates the data structures a generic rowset object might support.
Data structures supported by a generic rowset object
Other rowset interfaces expose additional rowset capabilities. For example, there is an interface to insert, delete, and update rows and interfaces that expose richer row navigation models, such as direct access and scrollability.
Rowsets are created in one of two ways. First, they can be created as the result of a query. Second, they can be created directly as the result of calling IOpenRowset::OpenRowset. All providers support creation by calling IOpenRowset::OpenRowset. However, simple providers — such as those built over a base table, index, file, or in-memory structure — generally do not support creation by query.
Index rowsets are rowsets whose rows are formed from index entries. Index rowsets have the additional property of allowing efficient access to contiguous rows within a range of keys. They are used primarily by query processor components. Indexes abstract the functionality of B-trees and indexed-sequential files.
Interface | Used for |
IRowset | Traverses indexes. |
IColumnsInfo | Obtains information about the index entries. |
IRowsetChange | Performs insertions and deletions. |