1

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!

stuck
  • 2,264
  • 2
  • 28
  • 62
  • If the columns are integers (=very small amount of data), I'd suggest defining a third index, over both columns. This way you'll be able to search "where X=10 and Y=20" using the single cursor. – Soonts Nov 27 '10 at 00:38

1 Answers1

3

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:

  2. For the second key value:

  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).
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Laurion Burchall
  • 2,843
  • 16
  • 12