[This is preliminary documentation and subject to change.]
SQLColumns returns a list of column names in specified tables. The information is returned in a result set on the specified hStmt.
For example, to get information on the columns in the TcpConnectionTable on the device (represented by a database) DatabaseName the client invokes:
SQLColumns (hstmt, "DatabaseName", SQL_NTS, // qualifier
NULL, 0, // owner
"TcpConnectionTable", SQL_NTS, // table
"%",SQL_NTS); // all columns
The first task of the adapter is to get a WBEM Gateway interface for the specified namespace. In this example the namespace is called "DatabaseName". With the Gateway interface the adapter has access to all the information contained within that namespace.
The next stage is to get the information for the specified table. This is obtained through a Gateway interface call. This call returns another WBEM interface which contains all the information about the table.
The adapter can now use this new WBEM interface to access the class properties and qualifiers. In particular, for the purposes of SQLColumns it needs to return the following information as a rowset:
Column Name | Data Type | Description |
---|---|---|
TABLE_QUALIFIER_NAME | Varchar (128) | The table qualifier. This corresponds to the database name. |
TABLE_OWNER | Varchar (128) | Not used. |
COLUMN_NAME | VarChar (128) | The column name (a WBEM Property Name) |
TYPE_NAME | VarChar (128), not NULLable | Data Type Name. This is a data source dependent type name. |
PRECISION | Integer | The precision of the column in the SMIR |
LENGTH | Integer | The length of the column. |
SCALE | SmallInt | The scale of the column. |
RADIX | SmallInt | The radix of the column. |
NULLABLE | SmallInt, not NULLable | NULLability of the column. |
REMARKS | Varchar (254) | A description of the column. |
ATTRIBUTES | Longvarchar (16384) | The column metadata. |
For a description of these terms, see the table in CIM to ODBC Mapping.
As can be observed from the preceding table, the WBEM ODBC Adapter extends the SQLColumns result set by an extra column. This is used to return the column metadata.
The metadata is displayed in the following format:
[metadata name][ metadata value]
[metadata name][ metadata value]
For example,
[ObjectId][1.2.3.4.5.6]
[Syntax][STRING(254)]
If the metadata name or value contains a left or right square bracket ([ or ]), then two such symbols are used instead. For example, in order to show fr[ed]dy, the following is displayed:
[fr[[ed]]dy]