Using Integrated Indexes

OLE DB Programmer's Reference

To fetch base table rows using two separate rowsets, one over the base table and another over the index, the consumer should do the following:

  1. Call IRowsetIndex::SetRange on the index rowset to set the range.
  2. (Optional) Call 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.
  3. Call IRowset::GetNextRows on the index rowset to fetch the index entry.
  4. Extract a bookmark from the index row that points to the corresponding row in the base table rowset.
  5. Call 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 should do the following:

  1. Call IRowsetIndex::SetRange on the base table rowset to set the range.
  2. (Optional) Call 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.
  3. Call 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.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net