开发者

in ESE (JetBlue) is there a way to limit a search with multiple keys?

In Extensbile Strage Engine (ESE/JetBlue) I've got a table that contains data I'd like to locate using two indexes

assuming that each row has three integers X, Y, and Z. I'd like to quickly locate all the rows where X=10 and Y=20 (for example)

the resulting set would contain all the entries where X=10, Y=20, and Z= whever Z happened to be

is this possible?

the sequence of

JetSetCurrentIndex(), JetMakeKey(), JetSeek()开发者_如何转开发, and JetMove() confuse me. i'm not 100% this is even possible without searching for X=10 and then filtering all values where Y!=20 myself?

thanks!


You can do that with the JetIntersectIndexes API, which returns all records contained in two index ranges. You need to:

  1. For the first key value:

    • Open the table (JetOpenTable)
    • select the index (JetSetCurrentIndex)
    • seek to the start the first index range (JetMakeKey, JetSeek)
    • create an index range on the first value (JetMakeKey, JetSetIndexRange)
  2. For the second key value:

    • open the table a second time (JetOpenTable)
    • select the other index (JetSetCurrentIndex)
    • seek in the index to the start of the second key value (JetMakeKey, JetSeek)
    • create an index range on the second value (JetMakeKey, JetSetIndexRange).
  3. Call JetIntersectIndexes with the two index ranges to create a temporary table of matching bookmarks.

  4. Enumerate the temporary table returned by the call (JetMove). Retrieve the record bookmarks (JetRetrieveColumn) and go to the records (JetGotoBookmark).
  5. Close the temporary table when done! (JetCloseTable).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜