Compartilhar via


IColumnsRowset::GetAvailableColumns

Returns a list of optional metadata columns that can be supplied in a column metadata rowset.

Syntax

HRESULT GetAvailableColumns (
   DBORDINAL   *pcOptColumns,
   DBID       **prgOptColumns);

Parameters

  • pcOptColumns
    [out] A pointer to memory in which to return the count of the elements in *prgOptColumns. If an error occurs, *pcOptColumns is set to zero.

  • prgOptColumns
    [out] A pointer to memory in which to return an array of the optional columns this provider can supply. In addition to the optional columns listed in IColumnsRowset::GetColumnsRowset, the provider can return provider-specific columns. The rowset or command allocates memory for the structures and returns the address to this memory; the consumer releases this memory with IMalloc::Free when it no longer needs the list of columns. If *pcOptColumns is zero on output or an error occurs, the provider does not allocate any memory and ensures that *prgOptColumns is a null pointer on output.

Return Code

  • S_OK
    The method succeeded.

  • E_FAIL
    A provider-specific error occurred.

  • E_INVALIDARG
    pcOptColumns or prgOptColumns was a null pointer.

  • E_OUTOFMEMORY
    The provider was unable to allocate sufficient memory in which to return the column IDs.

  • E_UNEXPECTED
    ITransaction::Commit or ITransaction::Abort was called, and the object is in a zombie state. This error can be returned only when the method is called on a rowset.

  • DB_E_NOCOMMAND
    No command text was set. This error can be returned only when this method is called from the command object.

  • DB_E_NOTPREPARED
    The command exposed ICommandPrepare, and the command text was set but the command was not prepared. This error can be returned only when this method is called from the command object.

  • DB_E_NOTREENTRANT
    The provider called a method from IRowsetNotify in the consumer that had not yet returned, and the provider does not support reentrancy in this method.

  • DB_SEC_E_PERMISSIONDENIED
    The consumer did not have sufficient permission to retrieve the available optional metadata columns.

Comments

This method makes no logical change to the state of the object.

Calling IColumnsRowset::GetAvailableColumns on a command before the command is executed might be an expensive operation.

See Also

Reference

IColumnsRowset::GetColumnsRowset