Referencing Row Handles

Each row handle has a reference (or usage) count managed by the provider. The reference count is incremented by methods that return row handles, or by IRowset::AddRefRows. Consumers must call IRowset::ReleaseRows each time the reference count is incremented implicitly on their behalf or explicitly by IRowset::AddRefRows. The only exception is IRowset::Release—on the final release, all referenced row handles are implicitly released.

CRowset contains its own versions of AddRefRows and ReleaseRows so that consumers do not have to access the attached base rowset to manage row handles. CRowset::FreeRows is an extended version of CRowset::ReleaseRows; it releases row handles and also frees the caller-allocated row handles array.