This project has moved and is read-only. For the latest updates, please go here.

JetGetSecondaryIndexBookmark and CreateIndexGrbit.IndexUnique

Mar 16, 2012 at 2:27 PM

This only happens on WinXP, not on Win7:

When using  JetGetSecondaryIndexBookmark with an index that was created with CreateIndexGrbit.IndexDisallowNull | CreateIndexGrbit.IndexUnique, then the actualPrimaryKeySize returned is 0 (no errors).

Without CreateIndexGrbit.IndexUnique it works just fine.

Any idea what's happening here? Is the Esent-version in XP broken?

Tobias

Mar 16, 2012 at 6:09 PM

That behaviour isn't broken, but it isn't as useful as you want.

JetGetSecondaryIndexBookmark was designed to let people navigate back to a secondary index entry. When an index is unique it looks like WinXP treats the entire key as the secondary index bookmark and only generates a primary bookmark for non-unique indexes. That does mean that JetGotoSecondaryIndexBookmark will work, but prevents the primary bookmark from being retrieved that way. JetGetBookmark will have to be called instead. I *think* that call will be equally fast.

Mar 16, 2012 at 10:34 PM
Edited Mar 16, 2012 at 10:37 PM

Thanks!

As the obvious purpose of JetGetSecondaryIndexBookmark is to get a secondary index entry, this kinda makes sense.

I stumbled upon this with RavenDB (link to discussion), but don't have really understood the dos and don'ts of the Esent API yet. Oren will probably fix this soon.