Direct Binding in Tree-Structured Namespaces

OLE DB Programmer's Reference

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:

  • The row object representing this node.
  • The rowset containing the children of the node. (This provides a shortcut alternative to binding to the row object and then calling IScopedOperations::OpenRowset.)

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:

  • If DBBINDURLFLAG_RECURSIVE is specified on the bind to the row object, it must also be specified on subsequent binds from the row object in which dwBindURLFlags is not zero.
  • If DBBINDURLFLAG_RECURSIVE and DBBINDURLFLAG_SHARE_DENY_READ and/or DBBINDURLFLAG_SHARE_DENY_WRITE are specified on the bind to the row object, these flags must also be specified on subsequent binds from the row object in which dwBindURLFlags is not zero. If only one of the SHARE_DENY flags was specified on the bind to the row, the client can use both in binds from the row.
  • If DBBINDURLFLAG_SHARE_DENY_NONE is specified on the bind to the row, the client may choose to specify either or both SHARE_DENY_READ and SHARE_DENY_WRITE on binds from the row object. DBBINDURLFLAG_SHARE_DENY_NONE cannot be legally combined with DBBINDURLFLAG_RECURSIVE unless other locking behaviors are requested. Therefore, if DBBINDURLFLAG_RECURSIVE was not specified on the bind to the row, the client is free to use it on binds from the row. If it was specified, the client is constrained by other rules in this list (because another locking behavior must have been requested as well).

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.

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