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

JetGetDatabaseInfo Function

· 52CE 我爱测

Learn more about: JetGetDatabaseInfo Function

Applies to: Windows | Windows Server

JetGetDatabaseInfo Function

The JetGetDatabaseInfo function retrieves various types of information about the database. This API can be called while a database is attached or online (with JetGetDatabaseInfo) or while the database or database engine is offline (with JetGetDatabaseFileInfo).

    JET_ERR JET_API JetGetDatabaseInfo(
      __in          JET_SESID sesid,
      __in          JET_DBID dbid,
      __out         void* pvResult,
      __in          unsigned long cbMax,
      __in          unsigned long InfoLevel
    );

Parameters

sesid

The session to use for this call.

dbid

The JET_DBID for the database to retrieve the information from.

pvResult

Pointer to a buffer which will receive the specified information. The size of the buffer, in bytes, is passed in cbMax.

On failure the contents of pvResult are undefined.

The information stored in pvResult depends on InfoLevel.

cbMax

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

InfoLevel

InfoLevel specifies which type of information should be retrieved about the specified database. It affects how pvResult is interpreted. Some InfoLevel are available only in the offline (JetGetDatabaseFileInfo) or online (JetGetDatabaseInfo) version of the API.

If the pvResult buffer provided is too small, either JET_errInvalidBufferSize or JET_errBufferTooSmall will be returned depending on the InfoLevel.

Value Meaning
JET_DbInfoCollate Not yet supported and return default values. Do not use.
JET_DbInfoConnect These InfoLevels are deprecated and are not currently supported. Do not use.
JET_DbInfoCountry Not yet supported and return default values. Do not use.
JET_DbInfoCp Not yet supported and return default values. Do not use.
JET_DbInfoFilename pvResult will be interpreted as a string buffer (char *). A MAX_PATH buffer is suggested, however not required. If the buffer is not long enough, JET_errBufferTooSmall will be returned. The string will be populated with the path of the database for this DBID.
JET_DbInfoFilesize pvResult will be interpreted as a DWORD (4 bytes). Returns the size of the database in pages.
JET_DbInfoIsam These InfoLevels are deprecated and are not currently supported. Do not use.
JET_DbInfoLCID (Windows XP and later) This InfoLevel was originally specified as: JET_DbInfoLangid (Windows 2000)pvResult will be interpreted as a long. This returns the Locale identifier (LCID) associate with this database.
JET_DbInfoMisc pvResult will be interpreted as a <a href="gg294147(v=exchg.10).md">JET_DBINFOMISC</a>. The <a href="gg294147(v=exchg.10).md">JET_DBINFOMISC</a> structure will be populated with information pertaining to the database specified.
JET_DbInfoOptions pvResult will be interpreted as a <a href="gg294066(v=exchg.10).md">JET_GRBIT</a> (DWORD). This returns whether the database is opened in exclusive mode. If the database is in exclusive mode JET_bitDbExclusive will be set in the <a href="gg294066(v=exchg.10).md">JET_GRBIT</a> provided, otherwise zero is set. Note other database grbit options for <a href="gg294074(v=exchg.10).md">JetAttachDatabase</a> and <a href="gg269299(v=exchg.10).md">JetOpenDatabase</a> are not returned.
JET_DbInfoPageSize Available only on Windows XP and later. pvResult will be interpreted as an unsigned long. This will return the page size of the database in bytes.
JET_DbInfoSpaceAvailable pvResult will be interpreted as a DWORD. This returns the available space for the database in pages.
JET_DbInfoSpaceOwned pvResult will be interpreted as a DWORD. This returns the owned space for the database in pages.
JET_DbInfoTransactions pvResult will be interpreted as a long. This will return one greater than the maximum level to which transactions can be nested. If <a href="gg294083(v=exchg.10).md">JetBeginTransaction</a> is called (in a nesting fashion, that is, on the same session, without a commit or rollback) as many times as this value, on the last call JET_errTransTooDeep will be returned from <a href="gg294083(v=exchg.10).md">JetBeginTransaction</a>. Note the value in Windows 2000, Windows XP, and Windows Server 2003 is 7.
JET_DbInfoVersion pvResult will be interpreted as a long. This returns the database engine's native major version. This value is 0x620 for Windows 2000, Windows XP, and Windows Server 2003.

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 size of the buffer given in cbMax was too small (or not correct) to hold the desired information.
JET_errFeatureNotAvailable The InfoLevel requested was JET_DbInfoIsam. This is not supported.
JET_errInvalidBufferSize The size of the buffer given in cbMax was too small (or not correct) to hold the desired information.
JET_errInvalidParameter One of the parameters provided contained an unexpected value or contained a value that did not make sense when combined with the value of another parameter. This error will be returned by JetGetDatabaseInfo when the <a href="gg269248(v=exchg.10).md">JET_DBID</a> provided is not a valid (attached) database. This error will be returned by <a href="gg269239(v=exchg.10).md">JetGetDatabaseFileInfo</a> and JetGetDatabaseInfo when an InfoLevel requested is not supported by that version of the function.

On success, the requested data will be returned in the output buffer.

On failure, the output buffer will be in an undefined state.

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

JET_DBID
JET_ERR
JET_GRBIT
JET_SESID
JET_DBINFOMISC
JET_DBINFOUPGRADE
JetGetDatabaseFileInfo

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)

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

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