/// <summary> /// If the records with the specified key ranges are not in the buffer /// cache, then start asynchronous reads to bring the records into the /// database buffer cache. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The table to issue the prereads against.</param> /// <param name="indexRanges">The key ranges to preread.</param> /// <param name="rangeIndex">The index of the first key range in the array to read.</param> /// <param name="rangeCount">The maximum number of key ranges to preread.</param> /// <param name="rangesPreread">Returns the number of keys actually preread.</param> /// <param name="columnsPreread">List of column ids for long value columns to preread.</param> /// <param name="grbit">Preread options. Used to specify the direction of the preread.</param> /// <returns><c>true</c> if some preread done, <c>false</c> otherwise.</returns> public static bool JetTryPrereadIndexRanges( JET_SESID sesid, JET_TABLEID tableid, JET_INDEX_RANGE[] indexRanges, int rangeIndex, int rangeCount, out int rangesPreread, JET_COLUMNID[] columnsPreread, PrereadIndexRangesGrbit grbit) { JET_err err = (JET_err)Api.Impl.JetPrereadIndexRanges(sesid, tableid, indexRanges, rangeIndex, rangeCount, out rangesPreread, columnsPreread, grbit); return err >= JET_err.Success; }
/// <summary> /// If the records with the specified key rangess are not in the buffer /// cache, then start asynchronous reads to bring the records into the /// database buffer cache. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The table to issue the prereads against.</param> /// <param name="indexRanges">The key rangess to preread.</param> /// <param name="rangeIndex">The index of the first key range in the array to read.</param> /// <param name="rangeCount">The maximum number of key ranges to preread.</param> /// <param name="rangesPreread">Returns the number of keys actually preread.</param> /// <param name="columnsPreread">List of column ids for long value columns to preread.</param> /// <param name="grbit">Preread options. Used to specify the direction of the preread.</param> /// <returns> /// An error if the call fails. /// </returns> public int JetPrereadIndexRanges( JET_SESID sesid, JET_TABLEID tableid, JET_INDEX_RANGE[] indexRanges, int rangeIndex, int rangeCount, out int rangesPreread, JET_COLUMNID[] columnsPreread, PrereadIndexRangesGrbit grbit) { TraceFunctionCall("JetPrereadIndexRanges"); this.CheckSupportsWindows8Features("JetPrereadIndexRanges"); CheckNotNull(indexRanges, "indexRanges"); CheckDataSize(indexRanges, rangeIndex, "rangeIndex", rangeCount, "rangeCount"); var handles = new GCHandleCollection(); try { NATIVE_INDEX_RANGE[] nativeRanges = new NATIVE_INDEX_RANGE[rangeCount]; for (int i = 0; i < rangeCount; i++) { nativeRanges[i] = indexRanges[i + rangeIndex].GetNativeIndexRange(ref handles); } if (columnsPreread != null) { var nativecolumnids = new uint[columnsPreread.Length]; for (int i = 0; i < columnsPreread.Length; i++) { nativecolumnids[i] = (uint)columnsPreread[i].Value; } return Err(NativeMethods.JetPrereadIndexRanges(sesid.Value, tableid.Value, nativeRanges, (uint)rangeCount, out rangesPreread, nativecolumnids, (uint)columnsPreread.Length, checked((uint)grbit))); } else { return Err(NativeMethods.JetPrereadIndexRanges(sesid.Value, tableid.Value, nativeRanges, (uint)rangeCount, out rangesPreread, null, (uint)0, checked((uint)grbit))); } } finally { handles.Dispose(); } }
/// <summary> /// If the records with the specified key ranges are not in the buffer /// cache, then start asynchronous reads to bring the records into the /// database buffer cache. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="tableid">The table to issue the prereads against.</param> /// <param name="indexRanges">The key ranges to preread.</param> /// <param name="rangeIndex">The index of the first key range in the array to read.</param> /// <param name="rangeCount">The maximum number of key ranges to preread.</param> /// <param name="rangesPreread">Returns the number of keys actually preread.</param> /// <param name="columnsPreread">List of column ids for long value columns to preread.</param> /// <param name="grbit">Preread options. Used to specify the direction of the preread.</param> public static void JetPrereadIndexRanges( JET_SESID sesid, JET_TABLEID tableid, JET_INDEX_RANGE[] indexRanges, int rangeIndex, int rangeCount, out int rangesPreread, JET_COLUMNID[] columnsPreread, PrereadIndexRangesGrbit grbit) { Api.Check(Api.Impl.JetPrereadIndexRanges(sesid, tableid, indexRanges, rangeIndex, rangeCount, out rangesPreread, columnsPreread, grbit)); }