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

JetGetTableInfo Function

· 52CE 我爱测

Learn more about: JetGetTableInfo Function

Applies to: Windows | Windows Server

JetGetTableInfo Function

The JetGetTableInfo function retrieves various pieces of information about a table in a database.

    JET_ERR JET_API JetGetTableInfo(
      __in          JET_SESID sesid,
      __in          JET_TABLEID tableid,
      __out         void* pvResult,
      __in          unsigned long cbMax,
      __in          unsigned long InfoLevel
    );

Parameters

sesid

The database session context to use for the API call.

tableid

The table that the information applies to.

pvResult

Pointer to a buffer that will receive the information. The type of the buffer is dependent on InfoLevel. It is the responsibility of the caller to align the buffer appropriately.

cbMax

The size, in bytes, of the buffer that was passed in pvResult.

InfoLevel

The type of information that will be retrieved for the table that is specified by tableid. The format of the data that is stored in pvResult is dependent on InfoLevel.

The following options can be set for this parameter:

Value Meaning
JET_TblInfo pvResult is interpreted as a <a href="gg269353(v=exchg.10).md">JET_OBJECTINFO</a> structure. If the method succeeds, the <a href="gg269353(v=exchg.10).md">JET_OBJECTINFO</a> structure is filled in with the appropriate data. If it fails, the contents are undefined.
JET_TblInfoDbid pvResult is treated as an array of two <a href="gg269248(v=exchg.10).md">JET_DBID</a> objects. The database identifier of the database that owns the table is stored in this array twice.
JET_TblInfoDumpTable JET_TblInfoDumpTable is deprecated. The API will return JET_errFeatureNotAvailable.
JET_TblInfoName JET_TblInfoName retrieves the name of the table and stores it in pvResult. If the buffer is too small, the behavior is undefined.
JET_TblInfoMostMany JET_TblInfoMostMany retrieves the name of the table and stores it in pvResult. If the buffer is too small, the behavior is undefined.
JET_TblInfoOLC JET_TblInfoOLC is deprecated. The API will return JET_errFeatureNotAvailable.
JET_TblInfoRvt JET_TblInfoRvt is deprecated. The API will return JET_errQueryNotSupported.
JET_TblInfoResetOLC JET_TblInfoResetOLC is deprecated. The API will return JET_errFeatureNotAvailable.
JET_TblInfoSpaceAlloc pvResult is interpreted as an array of two ULONGs:<ul><li>The first ULONG is the number of pages in the table.</li><li>The second ULONG is the target density of pages for the table.</li></ul>
JET_TblInfoSpaceAvailable pvResult is interpreted as a ULONG. The ULONG is the sum of the number of pages that are available in the table, its indexes, and the long value tree.
JET_TblInfoSpaceOwned pvResult is interpreted as a ULONG. The ULONG is the sum of the number of pages that are owned by the table (including its indexes, and the long value tree and any available pages therein).
JET_TblInfoSpaceUsage The behavior of the API depends on how large the buffer that is passed to the API is. Two cbMax values must be at least ( 2 * sizeof( ULONG ) ).<ul><li>If cbMax is ( 2 * sizeof( ULONG ) ), pvResult is interpreted as an array of two ULONGs:<ul><li>The first ULONG is the number of Owned Extents of the table.</li><li>The second ULONG is the number of Available Extents of the table.</li></ul></li><li>pvResult is interpreted as an array of:<ul><li>The first ULONG is the number of Owned Extents of the table.</li><li>The second ULONG is the number of Available Extents of the table.</li></ul></li></ul>
JET_TblInfoTemplateTableName pvResult is interpreted as a string buffer. The buffer must be at least JET_cbNameMost + 1, including the terminating NULL. If the table is a derived table, the buffer will be filled in with the name of the table from which the derived table inherited its DDL. If the table is not a derived table, the buffer will an empty string.

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_errBufferTooSmall The buffer was too small.
JET_errFeatureNotAvailable A deprecated InfoLevel was specified.
JET_errInvalidBufferSize The buffer was not the right size.
JET_errInvalidOperation The table that was passed in was a temporary table, and the requested InfoLevel cannot be retrieved for a temporary table.
JET_errObjectNotFound The table that was passed in was a temporary table, and the requested InfoLevel cannot be retrieved for a temporary table.
JET_errQueryNotSupported The InfoLevel is not supported.
JET_errTableInUse The table is being used by another database operation.
JET_errTableLocked The table is locked by another database operation.
JET_wrnTableInUseBySystem The table is being used by the system. This warning is nonfatal.
Remarks

Some pieces of information are not valid for temporary tables (See JetOpenTempTable).

The table statistics include the number of records and the number of pages in the clustered index (that is, the index containing the record data). The index statistics are accessed separately by name, using JetGetIndexInfo or JetGetTableIndexInfo.

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 JetGetTableInfoW (Unicode) and JetGetTableInfoA (ANSI).
See Also

JET_ERR
JET_GRBIT
JET_SESID
JET_TABLEID
JET_OBJECTINFO
JetGetIndexInfo
JetGetObjectInfo
JetGetTableIndexInfo
JetOpenTempTable

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)

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

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