ISourcesRowset::GetSourcesRowset

Returns a rowset of the data sources and enumerators visible from the current enumerator.

HRESULT GetSourcesRowset(
   IUnknown         pUnkOuter,
   REFIID            riid,
   ULONG         cPropertySets,
   DBPROPSET   rgPropertySets[],
   IUnknown **      ppSourcesRowset);

Parameters

pUnkOuter

A pointer to the controlling IUnknown interface if the sources rowset is being created as part of an aggregate. If the rowset is not part of an aggregate, this must be set to a null pointer.

riid

The IID of the interface on which to return a pointer. This interface is conceptually added to the list of required interfaces on the resulting rowset, and the method fails (E_NOINTERFACE) if that interface cannot be supported on the resulting rowset.

cPropertySets

[in]
The number of DBPROPSET structures in rgPropertySets. If this is zero, the provider ignores rgPropertySets.

rgPropertySets

[in/out]
An array of DBPROPSET structures containing properties and values to be set. The properties specified in these structures must belong to the Rowset property group. If the same property is specified more than once in rgPropertySets, then it is provider-specific which value is used. If cPropertySets is 0, this argument is ignored.

For information about the properties in the Rowset property group that are defined by OLE DB, see "Rowset Properties" in Appendix C. For information about the DBPROPSET and DBPROP structures, see "DBPROPSET Structure" and "DBPROP Structure" in Chapter 11.

ppSourcesRowset

A pointer to memory in which to return the requested interface pointer on the rowset. If an error occurs, the returned pointer is null.

Return Code

S_OK
The method succeeded. In all DBPROP structures passed to the method, dwStatus is set to DBPROPSTATUS_OK.

DB_S_ERRORSOCCURRED
The rowset was opened but one or more properties—for which the dwOptions element of the DBPROP structure was DBPROPOPTIONS_OPTIONAL—were not set. The consumer checks dwStatus in the DBPROP structures to determine which properties were not set. The method can fail to set properties for a number of reasons, including:

E_FAIL
A provider-specific error occurred.

E_INVALIDARG
ppSourcesRowset was a null pointer.

cPropertySets was not 0 and rgPropertySets was a null pointer.

In an element of rgPropertySets, cProperties was not 0 and rgProperties was a null pointer.

E_NOINTERFACE
The rowset did not support the interface specified in riid.

E_OUTOFMEMORY
The provider did not have enough memory to create the Rowset object.

E_UNEXPECTED
The Enumerator object was in an uninitialized state.

DB_E_ABORTLIMITREACHED
The method failed because a resource limit has been reached. For example, a query used to implement the method timed out. No rowset is returned.

DB_E_ERRORSOCCURRED
No rowset was returned because one or more properties—for which the dwOptions element of the DBPROP structure was DBPROPOPTIONS_REQUIRED or an invalid value—were not set. The consumer checks dwStatus in the DBPROP structures to determine which properties were not set. None of the satisfiable properties are remembered. The method can fail to set properties for any of the reasons specified in DB_S_ERRORSOCCURRED, except the reason that states that it was not possible to set the property.

DB_E_NOAGGREGATION
pUnkOuter was not a null pointer and the rowset did not support aggregation.

pUnkOuter was non-null and riid was not IID_Unknown.

Comments

GetSourcesRowset returns the following rowset. The rowset is read-only. The columns are returned in the order shown.

Column name Type indicator Description
SOURCES_NAME DBTYPE_WSTR The name of the data source or enumerator.
SOURCES_PARSENAME DBTYPE_WSTR String to pass to IParseDisplayName to obtain a moniker for the data source or enumerator.
SOURCES_DESCRIPTION DBTYPE_WSTR The description of the data source or enumerator.
SOURCES_TYPE DBTYPE_UI2 Whether the row describes a data source or an enumerator:
  • DBSOURCETYPE_DATASOURCE

  • DBSOURCETYPE_ENUMERATOR

If a single piece of code is capable of being used both as a data source and as an enumerator, it is listed in the rowset twice, once in each role.

SOURCES_ISPARENT DBTYPE_BOOL If the row describes an enumerator, SOURCES_ISPARENT is VARIANT_TRUE if the enumerator is the parent enumerator; that is, the enumerator whose enumeration contains the enumerator on which ISourcesRowset::GetSourcesRowset was just called. This allows the consumer to go backward through the enumeration. Whether an enumerator is able to enumerate its parent is provider-specific. Otherwise, SOURCES_ISPARENT is VARIANT_FALSE.

If the row describes a data source, SOURCES_ISPARENT is ignored by the consumer.



See Also

IDBProperties::GetPropertyInfo