Data Returned by Catalog Functions
Each catalog function returns data as a result set. This result set is no different from any other result set. It is usually generated by a predefined, parameterized SELECT statement that is hard-coded in the driver or stored in a procedure in the data source. For information about how to retrieve data from a result set, see Was a Result Set Created?.
The result set for each catalog function is described in the reference entry for that function. In addition to the listed columns, the result set can contain driver-specific columns after the last predefined column. These columns (if any) are described in the driver documentation.
Applications should bind driver-specific columns relative to the end of the result set. That is, they should calculate the number of a driver-specific column as the number of the last column — retrieved with SQLNumResultCols — less the number of columns that occur after the required column. This saves having to change the application when new columns are added to the result set in future versions of ODBC or the driver. For this scheme to work, drivers must add new driver-specific columns before old driver-specific columns so that column numbers do not change relative to the end of the result set.
Identifiers that are returned in the result set are not quoted, even if they contain special characters. For example, suppose the identifier quote character (which is driver-specific and returned through SQLGetInfo) is a double quotation mark (") and the Accounts Payable table contains a column named Customer Name. In the row returned by SQLColumns for this column, the value of the TABLE_NAME column is Accounts Payable, not "Accounts Payable", and the value of the COLUMN_NAME column is Customer Name, not "Customer Name". To retrieve the names of customers in the Accounts Payable table, the application would quote these names:
SELECT "Customer Name" FROM "Accounts Payable"
For more information, see Quoted Identifiers.
The catalog functions are based on an SQL-like authorization model in which a connection is made based on a user name and password, and only data for which the user has a privilege is returned. Password protection of individual files, which does not fit into this model, is driver-defined.
The result sets returned by the catalog functions are almost never updatable, and applications should not expect to be able to change the structure of the database by changing the data in these result sets.