/// <summary> /// Retrieves the key for the index entry at the current position of a cursor. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The cursor to retrieve the key from.</param> /// <param name="grbit">Retrieve key options.</param> /// <returns>The retrieved key.</returns> public static byte[] RetrieveKey(JET_SESID sesid, JET_TABLEID tableid, RetrieveKeyGrbit grbit) { byte[] buffer = Caches.BookmarkCache.Allocate(); int keySize; Api.JetRetrieveKey(sesid, tableid, buffer, buffer.Length, out keySize, grbit); byte[] key = MemoryCache.Duplicate(buffer, keySize); Caches.BookmarkCache.Free(ref buffer); return(key); }
/// <summary> /// Retrieves the key for the index entry at the current position of a cursor. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The cursor to retrieve the key from.</param> /// <param name="grbit">Retrieve key options.</param> /// <returns>The retrieved key.</returns> public static byte[] RetrieveKey(JET_SESID sesid, JET_TABLEID tableid, RetrieveKeyGrbit grbit) { // Get the size of the key, allocate memory, retrieve the key. int keySize; JetRetrieveKey(sesid, tableid, null, 0, out keySize, grbit); var key = new byte[keySize]; JetRetrieveKey(sesid, tableid, key, key.Length, out keySize, grbit); return(key); }
/// <summary> /// Retrieves the key for the index entry at the current position of a cursor. /// Also see <seealso cref="RetrieveKey"/>. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The cursor to retrieve the key from.</param> /// <param name="data">The buffer to retrieve the key into.</param> /// <param name="dataSize">The size of the buffer.</param> /// <param name="actualDataSize">Returns the actual size of the data.</param> /// <param name="grbit">Retrieve key options.</param> public static void JetRetrieveKey(JET_SESID sesid, JET_TABLEID tableid, byte[] data, int dataSize, out int actualDataSize, RetrieveKeyGrbit grbit) { Api.Check(Impl.JetRetrieveKey(sesid, tableid, data, dataSize, out actualDataSize, grbit)); }