MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 9: Row and Stream Objects


 

Direct Binding in Tree-Structured Namespaces

Navigation in tree-structured namespaces is done through row and rowset objects named by URLs. In this context, a URL identifies a particular node in the tree. Given a URL identifying such a node, a consumer can bind directly to the following:

When a consumer binds from the session object by using IBindResource, all specified bind options are propagated to any rowset, row, or stream object that is eventually created.

Inheritance of Bind Flags from the Row Object

If the consumer passes zero as the value for dwBindURLFlags when calling IBindResource::Bind on an existing row object, no flags are set, so the binding flags specified on the previous bind to the row object are reused. If any bind flags are set in the current bind request, none of the previous flag values are inherited. This is illustrated in the following example:

  1. Bind to http://example from the root binder with DBBINDURLFLAG_WRITE, obtaining row object A.

    Effective bind flag: DBBINDURLFLAG_WRITE

  2. Bind from row object A to http://example/subdirectory1 with no new bind flag (DBBINDFLAG) values specified.

    Effective bind flag: DBBINDURLFLAG_WRITE

  3. Bind from row object A to http://example/subdirectory2, specifying DBBINDURLFLAG_SHARE_DENY_WRITE.

    Effective bind flag: DBBINDURLFLAG_SHARE_DENY_WRITE

If the consumer specifies one or more bind flag values in dwBindURLFlags when calling IBindResource::Bind on the row object, the following rules govern the use of these flags on subsequent binds from the row object, based on the flags specified when binding to the row object:

Binding to Default Streams

Two important data stores have tree-structured namespaces: e-mail systems and file systems. For these data stores, the nodes in the tree are usually associated with a default stream that contains the contents of the file or the e-mail message as a binary stream. Consumers frequently find it useful to take a URL that represents the file or the e-mail and then bind to the default stream. In fact, in these scenarios, a given URL string can be modeled by both a row object (which models the properties of the name element) and a stream object (which models the default contents of the element). Thus, the URL of the default stream is the same as the URL of the row.

OLE DB 2.5 provides two ways to handle this scenario. First, the consumer can bind directly to the default stream represented by a URL, using IBindResource::Bind or ICreateRow::CreateRow. In this scenario, no row object is created.

Second, the consumer can create a row object using IBindResource::Bind, ICreateRow::CreateRow, or IScopedOperations::Bind. On the row object, the default stream column is identified by a special constant DBID. The consumer passes this DBID as an argument to the IRow::Open method to get the default stream. The stream object has an interface called IGetSourceRow, which has a method called GetSourceRow. This method can be used to get an interface pointer on the containing row object of the stream.