c# - Multi column index search Microsoft.Isam.Esent -
i facing following issue: have composite index on database index1 {binarycolumn1, binarycolumn2}. using following set index use:
api.jetsetcurrentindex(_session, _table, index1); to create key:
api.makekey(_session, _table, binaryvalue, makekeygrbit.newkey); and try perform search with:
api.tryseek(_session, _table, seekgrbit.seekeq); this works , seek returns true correctly if index1 1 column. if have multiple columns , try search value single column (ex. binarycolumn1 = {0x01, 0x23}) returns false.
how can search 1 value? (ps. cannot change index nor create new ones.) possible?
thank you
what did work {0x01, 0x00}. can't single call, because value of second column mixing seekeq grbit.
you seekge, you'll need retrieve column make sure value correct (and not {0x22, 0x23}). you'll have like: setcurrentindex() makekey( ..., binaryvalue1, makekeygrbit.newkey | makekeygrbit.fullcolumnstartlimit); // appends rest of search buffer 0x00's. seek(ge); makekey(... binaryvalue1, makekeygrbit.newkey | makekeygrbit.fullcolumnendlimit); // appends rest of search buffer 0xff's. api.jetsetindexrange(); can use api.trymovenext() iterate through rows have column equal binaryvalue1.
also @ test code included project -- howdoi.cs file has lots of examples.
sorry pseudo-code; don't have source code handy @ moment.
-martin
Comments
Post a Comment