Using Integrated Indexes
To fetch base table rows using two separate rowsets, one over the base table and another over the index, the consumer:
-
Calls IRowsetIndex::SetRange on the index rowset to set the range.
-
(Optional) Calls IRowsetIndex::Seek on the index rowset to seek a particular index value. This sets the next fetch position on the index rowset to the first row in the index rowset that matches the specified value.
-
Calls IRowset::GetNextRows on the index rowset to fetch the index entry.
-
Extracts a bookmark from the index row that points to the corresponding row in the base table rowset.
-
Calls IRowsetLocate::GetRowsAt on the base table rowset with the extracted bookmark to get the base table row.
To fetch base table rows using an integrated index, the consumer:
-
Calls IRowsetIndex::SetRange on the base table rowset to set the range.
-
(Optional) Calls IRowsetIndex::Seek on the base table rowset to seek a particular index value. This sets the next fetch position on the base table rowset to the first row in the index that matches the specified value.
-
Calls IRowset::GetNextRows on the base table rowset to fetch the base table row.
When using an integrated index rowset, there are three important differences from using separate index and base table rowsets:
-
The consumer sets index ranges and seeks for index values on the base table rowset itself.
-
No bookmarks are used in the process. This means that the base table rowset does not need to expose bookmarks, nor does it need to expose IRowsetLocate.
-
Updates applied on this rowset are simultaneously applied to the base table and index.