Getting Property Values
To get property values, a consumer must perform the following actions:
Determine the properties for which to get values.
Determine the property sets that contain the identified properties.
Allocate an array of DBPROPIDSET structures, one for each identified property set.
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.
Store the ID of each property in the appropriate DBPROPID array.
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.
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:
Allocate an array of DBPROPSET structures. The elements of this array correspond to the elements of the DBPROPIDSET array.
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.
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.
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.
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
The following table lists methods consumers can call to get property values.
Property group |
Methods used to get property values |
---|---|
Data Source |
|
Data Source Information |
|
Index |
|
Initialization |
|
Rowset |
ICommandProperties::GetProperties,IRowsetInfo::GetProperties |
Session |