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

JetCreateIndex Function

· 52CE 我爱测

Learn more about: JetCreateIndex Function

Applies to: Windows | Windows Server

JetCreateIndex Function

The JetCreateIndex function enables you to create an index of data in an Extensible Storage Engine (ESE) database, which you can use to locate specific data quickly.

    JET_ERR JET_API JetCreateIndex(
      __in          JET_SESID sesid,
      __in          JET_TABLEID tableid,
      __in          JET_PCSTR szIndexName,
      __in          JET_GRBIT grbit,
      __in          const tchar* szKey,
      __in          unsigned long cbKey,
      __in          unsigned long lDensity
    );

Parameters

sesid

The database session context to use for a particular API call.

tableid

The table that an index will be created for.

szIndexName

A pointer to a null-terminated string that specifies the name of the index to be created.

The index name must conform to the following guidelines:

  • It must contain fewer characters than JET_cbNameMost, not including the terminating null character.

  • It must contain only characters from the following categories: 0 through 9, A through Z, a through z, and all punctuation characters except for "!" (exclamation point), "," (comma), "[" (opening bracket), and "]" (closing bracket) — that is, the ASCII characters 0x20, 0x22 through 0x2d, 0x2f through 0x5a, 0x5c, and 0x5d through 0x7f.

  • It must not begin with a space.

  • It must contain at least one non-space character.

grbit

A group of bits that contains the options to be used for a particular call. This parameter can include zero or more of the options found in the JET_INDEXCREATE structure.

szKey

A pointer to a double null-terminated string of null-delimited tokens.

For more information about this parameter, see the JET_INDEXCREATE structure.

cbKey

The length, in bytes, of the szKey parameter, including the two terminating null characters.

lDensity

The percentage density of the initial index B+ tree.

For more information about this parameter, see the JET_INDEXCREATE structure.

Return Value

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

Return code Meaning
JET_errSuccess The operation completed successfully.

For a list of additional errors that can be returned by the JetCreateIndex function, see JetCreateIndex2.

Remarks

Calling the JetCreateIndex function is identical to calling the JetCreateIndex2 function with a JET_INDEXCREATE structure containing the same settings as the parameters of JetCreateIndex, and a cIndexCreate parameter equal to 1. For the fields of the JET_INDEXCREATE structure that do not have corresponding parameters in JetCreateIndex, a value of 0 is assumed.

Note that JetCreateIndex has been superseded by JetCreateIndex2.

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 Is declared in Esent.h.
Library Uses ESENT.lib.
DLL Requires ESENT.dll.
Unicode Is implemented as JetCreateIndexW (Unicode) and JetCreateIndexA (ANSI).
See Also

JET_ERR
JET_GRBIT
JET_SESID
JET_TABLEID
JET_INDEXCREATE
JetCreateIndex2
JetCreateTableColumnIndex
JetCreateTableColumnIndex2

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)

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

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