大网数据广告活动
磁盘与文件系统

JetPrereadKeys Function

· 52CE 我爱测

Learn more about: JetPrereadKeys Function

Applies to: Windows | Windows Server

JetPrereadKeys Function

The JetPrereadKeys function reads key values to improve the performance of version store cleanup.

Windows 7:  PrereadKeys function is introduced in Windows 7.

    JET_ERR JET_API JetPrereadKeys(
      __in JET_SESID sesid,
      __in JET_TABLEID tableid,
      __in_ecount(ckeys) const void ** rgpvKeys,
      __in_ecount(ckeys) const unsigned long * rgcbKeys,
      __in long ckeys,
      __out_opt long * pckeysPreread,
      __in JET_GRBIT grbit
     );

Parameters

sesid

The database session context to use for the API call.

tableid

The cursor to use for this call.

rgpvKeys

An array of pointers to keys. Keys can be made with JetMakeKey or retrieved with JetGetBookmark. The keys must be sorted in ascending or descending order, depending on the grbit passed. Keys can be sorted with memcmp.

rgcbKeys

An array of key lengths. rgpvKeys[n] should point to a key of length rgcbKeys[n]

ckeys

The number of keys. rgpvKeys and rgcbKeys must each point to an array with at least ckeys elements.

pckeysPreread

Returns the number of keys that prereads were actually issued for. This parameter can be NULL.

grbit

This must be either JET_bitPrereadForward or JET_bitPrereadBackward. If grbit is JET_bitPrereadForward, the keys must be sorted in ascending order. If grbit is JET_bitPrereadBackward, the keys must be sorted in descending order.

Return Value

This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.

Various I/O errors can be returned along with these API usage errors:

Return code Description
JET_errInvalidGrbit Grbit was neither JET_bitPrereadForward nor JET_bitPrereadBackward.
JET_errInvalidBufferSize An incorrect key size has been passed in. Keys can neither be 0 nor longer than the maximum key length for the table.
JET_errInvalidParameter An invalid parameter has been passed in. This can be caused by a null value for a required parameter or can indicate that the key array is not sorted properly.

JetPrereadKeys traverses the internal pages of the b-tree to determine which leaf pages contain the keys specified by rgpvKeys/rgcbKeys. The list of leaf pages is sorted and then prereads are issued for the ranges of pages. The number of pages that can be preread is limited so it is possible that not all keys may be preread. In that case, the number of keys actually preread is returned in pckeysPreread.

Requirements
Requirement Value
Client Requires Windows 7.
Server Requires Windows Server 2008 R2.
Header Declared in Esent.h.
Library Use ESENT.lib.
DLL Requires ESENT.dll.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 04/11/2016
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。