Lifetime of Storage Objects

OLE DB Programmer's Reference

Storage objects are freed in the same manner as other COM objects. Thus, when a consumer no longer needs a storage object created by a provider, it calls Release on that object. If the provider supports a VARIANT_FALSE value for DBPROP_MULTIPLESTORAGEOBJECTS, the consumer must always call Release on the storage object before it can open a new storage object on any row. Releasing a reference to a storage object does not free the storage object. Doing so only causes the reference count on the storage object to be decremented. When the object's reference count reaches zero, the object is freed automatically.

In addition, a storage object might enter a zombie state if one of the following events occurs:

  • The consumer calls Release to release the rowset containing the row.
  • The consumer calls IRowset::ReleaseRows to release the row containing the storage object.
  • The consumer calls ITransaction::Commit or ITransaction::Abort, and the retaining flag is set so that the rowset enters a zombie state.
  • The consumer deletes the row containing the storage object and transmits the deletion to the underlying data store.

When a storage object enters a zombie state, it is not automatically released. Instead, if the consumer calls any method on the storage object except Release, that method returns E_UNEXPECTED. It is the consumer's responsibility to release the storage object, even if it is in a zombie state.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net