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

JetGetDatabaseFileInfo Function

· 52CE 我爱测

Learn more about: JetGetDatabaseFileInfo Function

Applies to: Windows | Windows Server

JetGetDatabaseFileInfo Function

The JetGetDatabaseFileInfo 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 JetGetDatabaseFileInfo(
      __in          const tchar* szDatabaseName,
      __out         void* pvResult,
      __in          unsigned long cbMax,
      __in          unsigned long InfoLevel
    );

Parameters

szDatabaseName

The path of the database from which to retrieve the information.

pvResult

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

If this function fails, the contents of pvResult are undefined.

The information stored in pvResult depends on InfoLevel.

cbMax

The size, in bytes, of the buffer 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 objects 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.

<table> <colgroup> <col /> <col /> </colgroup> <thead> <tr class="header"> <th>Value</th> <th>Meaning</th> </tr> </thead> <tbody> <tr class="odd"> <td>JET_DbInfoFilesize</td> <td>pvResult will be interpreted as a QWORD (8 bytes). Returns the size of the database in bytes.</td> </tr> <tr class="even"> <td>JET_DbInfoUpgrade</td> <td>pvResult will be interpreted as a <a href="gg294114(v=exchg.10).md">JET_DBINFOUPGRADE</a>. The <a href="gg294114(v=exchg.10).md">JET_DBINFOUPGRADE</a> structure will be populated with information pertaining to the specified database.</td> </tr> <tr class="odd"> <td>JET_DbInfoMisc</td> <td>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 specified database.</td> </tr> <tr class="even"> <td>JET_DbInfoDBInUse</td> <td>pvResult will be interpreted as a BOOL (4 bytes). This will return whether the database engine currently has any open or attached databases. Windows XP:  This value is introduced in Windows XP.</td> </tr> <tr class="odd"> <td>JET_DbInfoPageSize</td> <td>pvResult will be interpreted as an unsigned long. This will return the page size of the database in bytes. Windows XP:  This value is introduced in Windows XP.</td> </tr> <tr class="even"> <td>JET_DbInfoCp</td> <td>These InfoLevels are not yet supported and return default values. Do not use these InfoLevels.</td> </tr> <tr class="odd"> <td>JET_DbInfoCountry</td> <td>These InfoLevels are not yet supported and return default values. Do not use these InfoLevels.</td> </tr> <tr class="even"> <td>JET_DbInfoCollate</td> <td>Same as JET_DbInfoCp.</td> </tr> <tr class="odd"> <td>JET_DbInfoIsam</td> <td>These InfoLevels are deprecated and are not currently supported. Do not use these InfoLevels.</td> </tr> <tr class="even"> <td>JET_DbInfoConnect</td> <td>Same as JET_DbInfoIsam.</td> </tr> <tr class="odd"> <td>JET_DbInfoFileType</td> <td>Windows Vista:  This InfoLevel value is introduced in Windows Vista. pvResult will be treated as a pointer to a DWORD. Returns an enumeration value, indicating what kind of file the engine considers this to be. File types are listed in the following table. For more information about these types of files and their usage to the engine, see <a href="gg294069(v=exchg.10).md">Extensible Storage Engine Files</a>.

<table> <colgroup> <col /> <col /> </colgroup> <thead> <tr class="header"> <th>Value</th> <th>Meaning</th> </tr> </thead> <tbody> <tr class="odd"> <td>JET_filetypeUnknown</td> <td>The type of file is unknown, or not an ESE file type.</td> </tr> <tr class="even"> <td>JET_filetypeDatabase</td> <td>The file is a database file.</td> </tr> <tr class="odd"> <td>JET_filetypeLog</td> <td>The file is a transaction log file.</td> </tr> <tr class="even"> <td>JET_filetypeCheckpoint</td> <td>The file is a checkpoint file.</td> </tr> <tr class="odd"> <td>JET_filetypeTempDatabase</td> <td>The file is a temporary database file.</td> </tr> </tbody> </table>

</td> </tr> </tbody> </table>

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.

<table> <colgroup> <col /> <col /> </colgroup> <thead> <tr class="header"> <th>Return code</th> <th>Description</th> </tr> </thead> <tbody> <tr class="odd"> <td>JET_errSuccess</td> <td>The operation completed successfully.</td> </tr> <tr class="even"> <td>JET_errFeatureNotAvailable</td> <td>The InfoLevel requested was JET_DbInfoIsam. This is not supported.</td> </tr> <tr class="odd"> <td>JET_errBufferTooSmall</td> <td>The buffer that is given in cbMax is too small for the desired information.</td> </tr> <tr class="even"> <td>JET_errInvalidBufferSize</td> <td>The buffer that is given in cbMax is not the correct size for the desired information.</td> </tr> <tr class="odd"> <td>JET_errInvalidParameter</td> <td>One of the parameters that was provided contained an unexpected value, or the combination of several parameter values yielded an unexpected result. This error will be returned by <a href="gg294076(v=exchg.10).md">JetGetDatabaseInfo</a> when the DBID provided is not a valid (attached) database. This error will be returned by JetGetDatabaseFileInfo and <a href="gg294076(v=exchg.10).md">JetGetDatabaseInfo</a> when an InfoLevel requested is not supported by that version of the function.</td> </tr> </tbody> </table>

If this function succeeds, the requested data will be returned in the output buffer.

If this function fails, the output buffer will be in an undefined state.

Requirements

<table> <colgroup> <col /> <col /> </colgroup> <tbody> <tr class="odd"> <td>Client</td> <td>Requires Windows Vista, Windows XP, or Windows 2000 Professional.</td> </tr> <tr class="even"> <td>Server</td> <td>Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.</td> </tr> <tr class="odd"> <td>Header</td> <td>Declared in Esent.h.</td> </tr> <tr class="even"> <td>Library</td> <td>Use ESENT.lib.</td> </tr> <tr class="odd"> <td>DLL</td> <td>Requires ESENT.dll.</td> </tr> <tr class="even"> <td>Unicode</td> <td>Implemented as JetGetDatabaseFileInfoW (Unicode) and JetGetDatabaseFileInfoA (ANSI).</td> </tr> </tbody> </table>

See Also

JET_ERR
JET_DBINFOMISC
JET_DBINFOUPGRADE
JetGetDatabaseInfo

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)

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

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