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:
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
)
- Open the table (
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
).
- open the table a second time (
Call
JetIntersectIndexes
with the two index ranges to create a temporary table of matching bookmarks.- Enumerate the temporary table returned by the call (
JetMove
). Retrieve the record bookmarks (JetRetrieveColumn
) and go to the records (JetGotoBookmark
). - Close the temporary table when done! (
JetCloseTable
).
精彩评论