Creating a Rowset with IOpenRowset

OLE DB Programmer's Reference

Some providers need to expose very simple rowsets to their consumers. Conceptually, these rowsets represent the result of the simple query SELECT * FROM Tablename. To allow providers to interpret this simple query without the overhead of supporting a complete query language, OLE DB provides a simple rowset interface, IOpenRowset. IOpenRowset effectively exposes a rowset in the absence of a command. IOpenRowset is implemented on the session as shown in the following illustration.

Creating a rowset directly with IOpenRowset

Fully Qualified Names

A consumer may need to construct a fully qualified table name incorporating the names of the associated schema and catalog.

To construct a fully qualified name if DBPROP_CATALOGLOCATION is DBPROPVAL_CL_START or the provider does not support the DBPROP_CATALOGLOCATION property, a consumer follows these steps:

  1. If DBLITERAL_CATALOG_NAME is not NULL and not an empty string (fSupported is TRUE in DBLITERALINFO), get the appropriate catalog name for the table (for example, from the TABLES schema rowset) and append the value of DBLITERAL_CATALOG_SEPARATOR (pwszLiteralValue in DBLITERALINFO).
  2. If DBLITERAL_SCHEMA_NAME is not NULL (fSupported is TRUE in DBLITERALINFO), get the appropriate schema name for the table (for example, from the TABLES schema rowset) and append the value of DBLITERAL_SCHEMA_SEPARATOR (pwszLiteralValue in DBLITERALINFO). Append this to the catalog information from the previous step.
  3. Append the object (table) name.

To construct a fully qualified name if DBPROP_CATALOGLOCATION is DBPROPVAL_CL_END, a consumer follows these steps:

  1. If DBLITERAL_SCHEMA_NAME is not NULL and not an empty string (fSupported is TRUE in DBLITERALINFO), get the appropriate schema name for the table (for example, from the TABLES schema rowset) and append the value of DBLITERAL_SCHEMA_SEPARATOR (pwszLiteralValue in DBLITERALINFO).
  2. Append the object (table) name.
  3. If DBLITERAL_CATALOG_NAME is not NULL (fSupported is TRUE in DBLITERALINFO), append the value of DBLITERAL_CATALOG_SEPARATOR (pwszLiteralValue in DBLITERALINFO) and the appropriate catalog name for the table (for example, from the TABLES schema rowset).
Note   Consumers should provide qualified table names only to reference tables in other schemas or catalogs. Further, consumers should not quote table names unless such quoting is required to make table names unambiguous (such as, to enforce case sensitivity). Providers for which quoting a simple table name has no meaning might not support quoting tables in IOpenRowset::OpenRowset while they do support quoting tables as part of a command text for parsing reasons. Providers should not require table names to be quoted and should guarantee that unquoted table names correctly open the specified table, even if the table name contains special characters, as long as the table can be unambiguously identified without quoting.

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