Udostępnij za pośrednictwem


BLOBs as Storage Objects

A COM object that exposes one or more storage interfaces such as ISequentialStream, IStream, IStorage, or ILockBytes is known as a storage object. In OLE DB, BLOBs can be bound as storage objects. When a BLOB is stored in a column as a storage object, the provider indicates this by setting the DBCOLUMNFLAGS_ISLONG bit in the dwFlags element of the column's DBCOLUMNINFO structure. The consumer can get or set the BLOB by calling methods on one of its storage interfaces.

The rows in the rowset act as containers for the storage objects. The relationship between a storage object and the row that contains it is the same as the relationship between an IStream or IStorage object and its parent IStorage object.

This relationship dictates the behavior of the storage object with respect to its containing row in many circumstances. For example, COM requires that all child objects are invalidated when a parent IStorage object is released. If IRowset::ReleaseRows frees a row handle and no other references to the row remain, any storage objects open in that row enter a zombie state. In this case, releasing the object usually is the only valid consumer action.

The following table shows the rowset methods and interfaces that are analogous to IStorage methods and modes.

IStorage method or mode

Rowset method, interface, or mode

Transacted mode

Deferred update mode

Direct mode

Immediate update mode

IStorage::Commit

IRowsetUpdate::Update

IStorage::Revert

IRowsetUpdate::Undo

IStorage::CreateStream, IStorage::OpenStream, IStorage::CreateStorage, IStorage::OpenStorage

IRowset::GetData

In most cases, BLOB data is not fetched and storage objects are not created until IRowset::GetData is called. Methods that fetch rows, such as IRowset::GetNextRows, do not usually return data for BLOB columns in the rowset's copy of the row.

For more information, see Getting and Setting BLOB Data with Storage Objects and Deferred Columns.

IStorage::DestroyElement

IRowsetChange::SetData

For more information, see Getting and Setting BLOB Data with Storage Objects.

This section contains the following topics:

This topic is a part of: