BLOBs as Storage Objects

OLE DB Programmer's Reference

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," later in this chapter, and "Deferred Columns" in Chapter 4: Rowsets.

IStorage::DestroyElement IRowsetChange::SetData

For more information, see "Getting and Setting BLOB Data with Storage Objects," later in this chapter.

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