Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Programming BLOBs and Large Text Fields
Collapse the table of content
Expand the table of content

Programming BLOBs and Large Text Fields

SQL Server 2000

Programming BLOBs and Large Text Fields

Repository engine provides interfaces to handle properties that are binary large objects (BLOBs) and large text fields. BLOBs are properties that have values containing text or image data that can be in excess of 64 kilobytes (KB). You can use BLOBs to perform database operations that require you to work with large segments of data at a time.

To define a BLOB, create a PropertyDef object, and then do the following:

  1. Set the SQLType property to SQL_LONGVARBINARY or SQL_LONGVARCHAR.

  2. Set the SQLBlobSize property to a value greater than 64 KB.

When SQLType is set to either SQL_LONGVARBINARY or SQL_LONGVARCHAR, SQLBlobSize (rather than SQLSize) determines the maximum size.

To work with a BLOB, use the IReposPropertyLarge interface. This interface provides methods that support BLOB manipulation. Specifically, it can be used to read, write, move, and seek information about a BLOB.

The locking behavior for the methods on this interface varies from the locking behavior used by other repository interfaces. Specifically, as soon as you invoke the Write and WriteToFile methods, the repository engine locks the database row until you commit the transaction. In contrast, locking for other rows only occurs for the duration of the commit.

When you use IReposPropertyLarge to manipulate an object, avoid using other repository property interfaces (such as IReposProperty or IReposProperty2) on the same property. These interfaces only work with properties that contain up to 64 KB of data. If your property exceeds 64 KB, you will only get the first 64 KB of it.

When you version a BLOB or large text field property, you can use CreateVersion to create the version and MergeVersion to combine versions. MergeVersion always selects the primary version of the BLOB or large text field. The new values are inserted directly into the database (rather than cached). For this reason, atomic operations are not supported for versioning these kinds of properties. For more information about atomicity of operations, see Transaction Management Overview.

For more information about other repository property interfaces, see Accessing Properties.

Note  IReposPropertyLarge is basically a dispatch-based version of the IStream OLE 2.0 interface.

For more information about handling BLOBs, search on "Stream Objects" and "IStream Interface" in the MSDN® Library at the Microsoft Web site.

See Also

Accessing Repository Objects

IPropertyDef2 Interface

IRepositoryObjectVersion::CreateVersion

IRepositoryObjectVersion::MergeVersion

IReposProperty Interface

IReposProperty2 Interface

IReposPropertyLarge Interface

PropertyDef Object

RepositoryObjectVersion CreateVersion Method

RepositoryObjectVersion MergeVersion Method

Show:
© 2015 Microsoft