共用方式為


IRowsetIndex::GetIndexInfo

Returns information about the index rowset capabilities.

HRESULT GetIndexInfo (
   DBORDINAL             *pcKeyColumns,
   DBINDEXCOLUMNDESC    **prgIndexColumnDesc,
   ULONG                 *pcIndexPropertySets,
   DBPROPSET            **prgIndexPropertySets);

Parameters

  • pcKeyColumns
    [out] A pointer to memory in which to return the number of key columns in the index.

  • prgIndexColumnDesc
    [out] A pointer to memory in which to return an array of DBINDEXCOLUMNDESC structures in key column order. The size of the array is equal to *pcKeyColumns.

    The provider 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 structures. If *pcKeyColumns is zero on output or if an error occurs, the provider does not allocate any memory and ensures that *prgIndexColumnDesc is a null pointer on output.

    For more information, see IIndexDefinition::CreateIndex.

  • pcIndexPropertySets
    [out] A pointer to memory in which to return the number of DBPROPSET structures returned in *prgIndexPropertySets. *pcIndexPropertySets is the total number of property sets for which the provider supports at least one property in the Index property group. If an error occurs, *pcIndexPropertySets is set to zero.

  • prgIndexPropertySets
    [out] A pointer to memory in which to return an array of DBPROPSET structures. One structure is returned for each property set that contains at least one property belonging to the Index property group. For information about the properties in the Index property group that are defined by OLE DB, see Index Property Group in Appendix C.

    The provider 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 structures. Before calling IMalloc::Free for *prgPropertySets, the consumer should call IMalloc::Free for the rgProperties element within each element of *prgPropertySets. The consumer must also call VariantClear for the vValue member of each DBPROP structure in order to prevent a memory leak in cases where the variant contains a reference type (such as a BSTR.) If *pcIndexPropertySets is zero on output or if an error occurs, the provider does not allocate any memory and ensures that *prgIndexPropertySets is a null pointer on output.

    For information about the DBPROPSET and DBPROP structures, see DBPROPSET Structure and DBPROP Structure.

Return Code

  • S_OK
    The method succeeded.

  • E_FAIL
    A provider-specific error occurred.

  • E_INVALIDARG
    pcKeyColumns, prgIndexColumnDesc, pcIndexPropertySets, or prgIndexPropertySets was a null pointer.

  • E_OUTOFMEMORY
    The provider was unable to allocate sufficient memory in which to return the column description structures or properties of the index.

  • DB_E_NOINDEX
    The rowset uses integrated indexes, and there is no current index.

See Also

Reference

IDBProperties::GetPropertyInfo

IIndexDefinition::CreateIndex