共用方式為


Getting Information About Properties

To get information about properties, a consumer can perform the following actions:

  1. Determine the properties for which to get information.

  2. Determine the property sets that contain the identified properties.

  3. Allocate an array of DBPROPIDSET structures, one for each identified property set.

  4. Allocate an array of DBPROPIDs for each property set. The number of elements in the array is determined by the number of properties identified in step 1 that belong to that property set.

  5. Store the ID of each property in the appropriate DBPROPID array.

  6. Store the GUID for each property set in the appropriate DBPROPIDSET structure. The consumer then stores a pointer to the corresponding DBPROPID array, along with the number of elements in the array, in the same DBPROPIDSET structure.

  7. Call a method that gets properties and pass it the count and array of DBPROPIDSET structures.

To return property values, the provider can perform the following actions:

  1. Allocate an array of DBPROPINFOSET structures. The elements of this array correspond to the elements of the DBPROPIDSET array.

  2. For each element of the DBPROPIDSET array, allocate an array of DBPROPINFO structures. The elements of the DBPROPINFO array correspond to the elements of the DBPROPID array.

  3. Store the ID, description, type, property group, whether the property can be read from or written to, and list of valid values of each property in the DBPROPINFO structure that correspond to the DBPROPID value for that property. For properties that do not apply to columns, the provider sets the column ID to NULL_ID.

  4. Store the GUID for each property set in the appropriate DBPROPINFOSET structure. The provider then stores a pointer to the corresponding DBPROPINFO array, along with the number of elements in the array, in the same DBPROPINFOSET structure.

  5. Return the number of DBPROPINFOSET structures, along with the array of DBPROPINFOSET structures itself, to the consumer.

For example, assume that the consumer wants to get information about five properties, where properties 1, 2, and 3 are in property set A and properties 4 and 5 are in property set B. The consumer uses the structures shown in the following illustration.

An example of how a consumer gets information about properties

getting property information

The provider returns the structures shown in the following illustration.

An example of what property information a provider returns

returning property inforrmation

The following table lists methods consumers can call to get information about properties.

Property group

Methods used to get information about properties

All property groups

IDBProperties::GetPropertyInfo

Data Source Creation

IDBDataSourceAdmin::GetCreationProperties

Initialization

IDBDataSourceAdmin::GetCreationProperties

Session

IDBDataSourceAdmin::GetCreationProperties