Column Values
The columns in a row can be of any OLE DB data type, including instances of other COM objects (whose data type is DBTYPE_IUnknown), such as row, stream, and rowset objects.
Row object column values can be retrieved using the IRow interface, which all providers are required to support on row objects, and they can be updated using the optional IRowChange interface.
Getting Column Values
To retrieve the values of one or more columns from a row object, the consumer calls IRow::GetColumns. This method does not require an accessor object. Instead, the consumer passes an array of DBCOLUMNACCESS structures. Similarly, status information is returned in the output argument of this method rather than via an accessor. For more information, see the reference entry for IRow::GetColumns.
To open an object-valued column, such as the default stream for a row object, the consumer calls IRow::Open, which opens the COM object contained in the column and returns an interface pointer on it. For more information about object-valued columns, see BLOBs and COM Objects.
The following rules govern how the DBPROP_ACCESSORDER property interacts with various methods to determine the order in which columns are retrieved from a row object:
If the row is obtained from a rowset by IGetRow::GetRowFromHROW, the row inherits its access order from the rowset; that is, the row access order is the same as the rowset access order.
If the row is obtained by an IOpenRowset::OpenRowset singleton select operation, and this property is set, the row access order is as specified by this property.
If the row is obtained by an ICommand::Execute or IMultipleResults::GetResult singleton select operation or a direct binding operation, and this property is set, the row access order is as specified by this property. For maximum interoperability with various providers, consumers should set the default value for this property to DBPROPVAL_AO_SEQUENTIALSTORAGEOBJECTS.
Setting Column Values
To update the value of one or more columns of a row object, the consumer calls IRowChange::SetColumns. As with IRow::GetColumns, no accessor object is required. The consumer specifies the number of columns to update, information such as the name and type of the column, and a buffer to hold the update value in an array of DBCOLUMNACCESS structures passed as an argument to the method.
If two row objects are created from the same row handle in a source rowset, metadata (schema) and data changes made to one row object are not visible to the other row object. However, once the changes have been transmitted to the underlying data store and the source rowset is recreated or refreshed (for example, by calling IRowsetRefresh::RefreshVisibleData), these changes are visible to new row objects that are created from the row handle.
If two row objects are created from the same row in the underlying data store but do not share a common source rowset, metadata (schema) and data changes made to one row object are not visible to the other row object. However, they are visible to new row objects that are created from the underlying row.
This topic is a part of: