Creating a Rowset with IOpenRowset

Some providers need to expose very simple rowsets to their consumers. These rowsets represent the result set of the simple query SELECT * FROM table-name. 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 figure.

Getting a rowset directly from a session

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, a consumer should follow these steps:

If DBPROP_CATALOGLOCATION is DBPROPVAL_CL_START:

  1. If DBLITERAL_CATALOG_NAME is not NULL (fSupported is TRUE in DBLITERALINFO), get the appropriate catalog name for the table (for instance, 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 instance, 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.

If DBPROP_CATALOGLOCATION is DBPROPVAL_CL_END:

  1. If DBLITERAL_SCHEMA_NAME is not NULL (fSupported is TRUE in DBLITERALINFO), get the appropriate schema name for the table (for instance, 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 instance, from the TABLES schema rowset).

Note   If a DBLITERAL_QUOTE_* character is supported, the provider must support enclosing names/identifiers in this quote character (with each part of the name individually quoted—for example, "catalog"."schema"."table", not "catalog.schema.table"). If a DBLITERAL_QUOTE_* character is not supported, the consumer should not quote identifiers. In addition, a provider should not quote the information passed to it.