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

JetGetColumnInfo Function

· 52CE 我爱测

Learn more about: JetGetColumnInfo Function

Applies to: Windows | Windows Server

JetGetColumnInfo Function

The JetGetColumnInfo function retrieves information about a column.

    JET_ERR JET_API JetGetColumnInfo(
      __in          JET_SESID sesid,
      __in          JET_DBID dbid,
      __in          const tchar* szTableName,
      __in          const tchar* szColumnName,
      __out         void* pvResult,
      __in          unsigned long cbMax,
      __in          unsigned long InfoLevel
    );

Parameters

sesid

The database session context to use for the API call.

dbid

Identifies, along with szTableName, the table that contains the column from which the information is retrieved.

szTableName

Identifies, along with dbid, the table that contains the column from which the information is retrieved.

szColumnName

The name of the column that information is fetched for.

pvResult

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

cbMax

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

InfoLevel

The type of information to retrieve for the column that is specified by szColumnName. The format of the data stored in pvResult is dependent on this parameter. For the schema of the temporary table, see JET_COLUMNLIST.

These InfoLevels are differentiated by:

  • JET_ColInfoListSortColumnid will sort the temporary table by columnid.

  • JET_ColInfoListCompact will compact the output. For more information about the compact output, see JET_COLUMNLIST.

The following options are available for use with this parameter.

Value Meaning
JET_ColInfo JET_ColInfo and JET_ColInfoByColid both retrieve the same information. pvResult is interpreted as a <a href="gg294130(v=exchg.10).md">JET_COLUMNDEF</a>, and the fields of the <a href="gg294130(v=exchg.10).md">JET_COLUMNDEF</a> structure are filled in appropriately.
JET_ColInfoBase pvResult is interpreted as a <a href="gg269194(v=exchg.10).md">JET_COLUMNBASE</a> structure. This is similar to a <a href="gg294130(v=exchg.10).md">JET_COLUMNDEF</a> structure. If this function succeeds, the structure is populated with appropriate values. If this function fails, the structure contains undefined data.
JET_ColInfoByColid Like JET_ColInfo, pvResult is interpreted as a <a href="gg294130(v=exchg.10).md">JET_COLUMNDEF</a>, except this InfoLevel indicates that the requested column (szColumName) is not the string column name, but a pointer to a <a href="gg294104(v=exchg.10).md">JET_COLUMNID</a>.
JET_ColInfoList pvResult is interpreted as a <a href="gg269228(v=exchg.10).md">JET_COLUMNLIST</a> structure. If this function succeeds, the structure is populated with appropriate values. A temporary table is opened and is identified by the tableid member of the <a href="gg269228(v=exchg.10).md">JET_COLUMNLIST</a> structure. The table must be closed with <a href="gg294087(v=exchg.10).md">JetCloseTable</a>. If this function fails, the structure contains undefined data.
JET_ColInfoListCompact Same as JET_ColInfoList.
JET_ColInfoListSortColumnid Same as JET_ColInfoList; however the resulting table is sorted by columnid, instead of column name.
JET_ColInfoSysTabCursor JET_ColInfoSysTabCursor is deprecated, and use of it will return JET_errFeatureNotAvailable.
JET_ColInfoBaseByColId Like JET_ColInfoBase, pvResult is interpreted as a <a href="gg269194(v=exchg.10).md">JET_COLUMNBASE</a>, except this InfoLevel indicates that requested column (szColumName) is not the string column name, but a pointer to a <a href="gg294104(v=exchg.10).md">JET_COLUMNID</a>.Windows Vista:  This value is introduced in Windows Vista.
JET_ColInfoGrbitNonDerivedColumnsOnly Only return non-derived columns (if the table is derived from a template).This value can be logically or'd into the InfoLevel, when the base InfoLevel is JET_ColInfoList.Windows Vista:  This value is introduced Windows Vista.
JET_ColInfoGrbitMinimalInfo Only return the column name and columnid of each column.This value can be logically or'd into the InfoLevel, when the base InfoLevel is JET_ColInfoList.Windows Vista:  This value is introduced in Windows Vista.
JET_ColInfoGrbitSortByColumnid Sort returned column list by columnid (default is to sort list by column name).This value can be logically or'd into the InfoLevel, when the base InfoLevel is JET_ColInfoList.Windows Vista:  This value is introduced in Windows Vista.

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_errColumnNotFound The column named szColumnName was not found in the table.
JET_errFeatureNotAvailable A bad InfoLevel was specified.
JET_errInvalidName This error can be returned if:<ul><li>A bad name for szTableName was given.</li><li>A bad name for szColumnName was given.</li></ul>
JET_errInvalidParameter This error can be returned if:<ul><li>A bad InfoLevel was specified.</li><li>A NULL szTableName was passed in.</li><li>The buffer is too small.</li></ul>
Remarks

JetGetTableColumnInfo and JetGetColumnInfo both retrieve information about a column. The difference between them is how the table is identified:

  • JetGetTableColumnInfo identifies a table by tableid.

  • JetGetColumnInfo identifies a table by dbid and szTableName combination.

When retrieving data with JET_ColInfoList, JET_ColInfoListSortColumnid, or JET_ColInfoListCompact, a temporary table will be opened. The temporary table contains data, and the JET_COLUMNLIST structure contains sufficient information to traverse the temporary table. The temporary table must be closed with JetCloseTable.

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

Error Handling Parameters
Extensible Storage Engine Errors
JET_COLUMNBASE
JET_COLUMNDEF
JET_COLUMNID
JET_COLUMNLIST
JET_ERR
JET_GRBIT
JET_SESID
JET_TABLEID
JetCloseTable
JetGetTableColumnInfo

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)

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

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