Поделиться через


Getting Property Values

  1. To get property values, a consumer must perform the following actions:

  2. Determine the properties for which to get values.

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

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

  5. 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.

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

  7. 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.

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

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

  1. Allocate an array of DBPROPSET 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 DBPROP structures. The elements of the DBPROP array correspond to the elements of the DBPROPID array.

  3. Store the value, column ID, whether the property is required or optional, and status of each property in the DBPROP structure that corresponds to the DBPROPID value for that property.

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

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

For example, assume that the consumer wants to get values for 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 figure.

An example of how a consumer gets property values

The provider returns the structures shown in the following illustration.

An example of what property values a provider returns

how a consumer gets property values

The following table lists methods consumers can call to get property values.

Property group

Methods used to get property values

Data Source

IDBProperties::GetProperties

Data Source Information

IDBProperties::GetProperties

Index

IRowsetIndex::GetIndexInfo

Initialization

IDBProperties::GetProperties

Rowset

ICommandProperties::GetProperties,IRowsetInfo::GetProperties

Session

ISessionProperties::GetProperties