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

JetGetIndexInfo Function

· 52CE 我爱测

Learn more about: JetGetIndexInfo Function

Applies to: Windows | Windows Server

JetGetIndexInfo Function

The JetGetIndexInfo function retrieves information about an index.

    JET_ERR JET_API JetGetIndexInfo(
      __in          JET_SESID sesid,
      __in          JET_DBID dbid,
      __in          const tchar* szTableName,
      __in          const tchar* szIndexName,
      __out         void* pvResult,
      __in          unsigned long cbResult,
      __in          unsigned long InfoLevel
    );

Parameters

sesid

The database session context to use for the API call.

dbid

The database identifier to use for the API call.

szTableName

The name of the table containing the index with the information to retrieve.

szIndexName

The name of the index with the information to retrieve.

pvResult

Pointer to a buffer that will receive the desired information. The buffer should be aligned to hold the type required. The type of the buffer is dependent on the InfoLevel parameter.

cbResult

The size, in bytes, of the buffer passed as pvResult.

InfoLevel

The information that will be stored in pvResult. The following options can be used for this parameter.

Value Meaning
JET_IdxInfo pvResult is interpreted as a JET_INDEXLIST</a> structure. On success, the <a href="gg269185(v=exchg.10).md">JET_INDEXLIST</a> structure receives information about the index. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoCount pvResult is interpreted as a ULONG. On success, the ULONG holds the count of indexes on the specified table. szIndexName is ignored. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoIndexId pvResult is interpreted as a JET_INDEXID</a>. On success, the <a href="gg269327(v=exchg.10).md">JET_INDEXID</a> structure receives information about the index. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoLangid JET_IdxInfoLangid is deprecated. Use JET_IdxInfoLCID and the <a href="/windows/win32/api/winnt/nf-winnt-langidfromlcid">LANGIDFROMLCID</a> macro instead.
JET_IdxInfoLCID pvResult is interpreted as an LCID. On success, the LCID holds the Locale Identifier of the index. On failure, the contents of pvBuffer are undefined.Windows XP:  JET_IdxInfoLCID is introduced in Windows XP.
JET_IdxInfoList pvResult is interpreted as a JET_INDEXLIST structure. On success, the <a href="gg269185(v=exchg.10).md">JET_INDEXLIST</a> structure receives information about the index. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoOLC JET_IdxInfoOLC is obsolete.
JET_IdxInfoResetOLC JET_IdxInfoResetOLC is obsolete.
JET_IdxInfoSpaceAlloc pvResult is interpreted as a ULONG. On success, the ULONG holds the target density (ulDensity) of the index. See JET_INDEXCREATE for a description of ulDensity. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoSysTabCursor JET_IdxInfoSysTabCursor is obsolete.
JET_IdxInfoVarSegMac pvResult is interpreted as a USHORT. On success, the USHORT holds the value of cbVarSegMac used when the index was created. See JET_INDEXCREATE for a description of cbVarSegMac. On failure, the contents of pvBuffer are undefined.
JET_IdxInfoKeyMost pvResult is interpreted as a USHORT. On success, the USHORT holds the value of cbKeyMost used when the index was created. See JET_INDEXCREATE for a description of cbKeyMost. On failure, the contents of pvBuffer are undefined.Windows Vista:  JET_IdxInfoKeyMost is introduced in Windows Vista.
JET_IdxInfoCreateIndex pvResult is interpreted as a JET_INDEXCREATE structure. On failure, the contents of pvBuffer are undefined.Windows 7:  JET_IdxInfoCreateIndex is introduced in Windows 7.
JET_IdxInfoCreateIndex2 pvResult is interpreted as a JET_INDEXCREATE2 structure. On failure, the contents of pvBuffer are undefined.Windows 7:  JET_IdxInfoCreateIndex2 is introduced in Windows 7.
JET_IdxInfoSpaceOwned pvResult is interpreted as a ULONG. On success, the ULONG holds the number of pages owned by the index. See Remarks for more information. Windows 11: JET_IdxInfoSpaceOwned is introduced in Windows 11.
JET_IdxInfoSpaceAvail pvResult is interpreted as a ULONG. On success, the ULONG holds the number of pages available in the index. See Remarks for more information. Windows 11: JET_IdxInfoSpaceAvail is introduced in Windows 11.

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.

Return code Description
JET_errSuccess The operation completed successfully.
JET_errIndexNotFound The specified index cannot be found in the specified table.
JET_wrnBufferTruncated The buffer passed in as pvResult was too small. The contents of the buffer are undefined.
Remarks

JetGetIndexInfo and JetGetTableIndexInfo retrieve identical information about an index. The difference is in how the table is specified. JetGetIndexInfo expects a database (dbid) and name of a table (szTableName), while JetGetTableIndexInfo expects a table identifier (tableid).

The space consumed by an index is defined by $Used + Avail = Owned$. Therefore to get the number of pages in use, use the formula $Owned - Avail = Used$ (retrievable with JET_IdxInfoSpaceOwned and JET_IdxInfoSpaceAvail).

Requirements
Requirement Value
Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header Declared in Esent.h.
Library Use ESENT.lib.
DLL Requires ESENT.dll.
Unicode Implemented as JetGetIndexInfoW (Unicode) and JetGetIndexInfoA (ANSI).
See Also

JET_COLUMNID JET_ERR JET_GRBIT JET_INDEXCREATE JET_INDEXCREATE2 JET_INDEXID JET_INDEXLIST JET_SESID JET_TABLEID JetGetTableIndexInfo

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)

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

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