IColumnsInfo

IColumnsInfo is the simpler of two interfaces that can be used to expose information about columns of a rowset or prepared command. It provides a limited set of information in an array.

When to Implement

All rowsets and commands implement IColumnsInfo. Service components can synthesize IColumnsRowset from this so that consumers and providers have independent choice of whether they want to code for simple limited information or to work with flexible and open-ended column descriptions.

IColumnsInfo is required both on commands and on rowsets.

When to Call

IColumnsInfo::GetColumnInfo returns the most commonly used metadata: column IDs, data types, updatability, and so on. IColumnsInfo::GetColumnInfo returns the metadata in an array of structures, which can be created and accessed quickly. The metadata returned, however, is limited.

Consumers that require more complete metadata can obtain it by calling IColumnsRowset::GetColumnsRowset.

Note

For commands that expose ICommandPrepare, the methods on this interface can be called only after the command is prepared or the rowset is instantiated. If a command text is set but not prepared, any calls to methods on IColumnsInfo return DB_E_NOTPREPARED. For commands that do not expose ICommandPrepare, the methods on this interface can be called only after the command text has been set.

Method

Description

GetColumnInfo

Returns the column metadata needed by most consumers.

MapColumnIDs

Returns an array of ordinals of the columns in a rowset that are identified by the specified column IDs.

This topic is a part of: