Udostępnij za pośrednictwem


Releasing Rowsets

When the consumer is done with the rowset, it must release it as follows:

  • If the consumer has created any accessors on the rowset, it must release them by calling IAccessor::ReleaseAccessor on each accessor individually.

  • To release the rowset object itself, the consumer must call IUnknown::Release on each interface pointer retrieved on the rowset. When the rowset is released, it forces the release of any remaining row handles the consumer holds. Such handle objects are subordinate to the rowset and cannot cause it to linger beyond the point where all the interfaces for the rowset have been released. The rowset is responsible for cleaning up all such subordinate objects.

Note

If the consumer obtained the rowset by executing a command containing output parameters and the provider populates output parameters when the rowset is released (that is, the value of DBPROP_OUTPUTPARAMETERAVAILABILITY is DBPROP_OA_ATROWRELEASE), the consumer must ensure that memory allocated for the output parameters that were bound at ICommand::Execute time must still be valid when the rowset is released. Not doing so is a serious programming error that can cause abnormal termination.