[This is preliminary documentation and subject to change.]
The Common Information Model (CIM) maps to ODBC as follows:
The property qualifiers are exposed to the ODBC clients by using SQLColumns. Some of the metadata is used to determine the standard metadata exposed by SQLColumns. All qualifiers are contained as a SQL_LONGVARCHAR in a thirteenth column added to the resultant rowset. The adapter only exposes qualifiers on a per-class basis, not on a per-class, per-instance basis. Therefore, information in qualifiers that vary over instances is inaccessible. See SQLColumns for more information.
The following table shows the mapping of variant types to ODBC types.
Variant Type | Data source-Dependent Name | CIMTYPE String | SQL Type |
---|---|---|---|
VT_UI1 | UINT8 | UINT8 | SQL_TINYINT |
VT_I2 | SINT8 | SINT8 | SQL_TINYINT |
VT_I2 | SINT16 | SINT16 Default case if nothing else matches |
SQL_SMALLINT |
VT_I4 | UINT16 | UINT16 | SQL_SMALLINT |
VT_I4 | UINT32 | UINT32 | SQL_INTEGER |
VT_I4 | SINT32 | SINT32 Default case if nothing else matches |
SQL_INTEGER |
VT_BSTR | SINT64 | SINT64 | SQL_BIGINT |
VT_BSTR | UINT64 | UINT64 | SQL_BIGINT |
VT_BSTR | INTERVAL | INTERVAL | SQL_TIMESTAMP |
VT_BSTR | TIMESTAMP | DATETIME | SQL_TIMESTAMP |
VT_BSTR | DATE | DATE | SQL_DATE |
VT_BSTR | TIME | TIME | SQL_TIME |
VT_BSTR | SMALL_STRING | STRING The property must also have a MAX qualifier with a value <= 254. Default case if nothing else matches If the MAX qualifier value cannot be retrieved, the default value of 254 is used. |
SQL_VARCHAR |
VT_BSTR | STRING | STRING The property must also have a MAX qualifier with value > 254. If MAX qualifier value > 16384, it is truncated to 16384. |
SQL_LONGVARCHAR |
VT_R4 | REAL | SQL_DOUBLE | |
VT_R8 | DOUBLE | SQL_DOUBLE | |
VT_BOOL | BIT | SQL_BIT | |
VT_ARRAY | VT_UI1 | SINT8_ARRAY | SINT8 | SQL_LONGVARBINARY |
VT_ARRAY | VT_I2 | UINT8_ARRAY | UINT8 | SQL_LONGVARBINARY |
VT_ARRAY | VT_I2 | SINT16_ARRAY | SINT16 Default case if nothing else matches |
SQL_LONGVARBINARY |
VT_ARRAY | VT_I4 | UINT16_ARRAY | UINT16 | SQL_LONGVARBINARY |
VT_ARRAY | VT_I4 | UINT32_ARRAY | UINT32 | SQL_LONGVARBINARY |
VT_ARRAY | VT_I4 | SINT32_ARRAY | SINT32 Default case if nothing else matches |
SQL_LONGVARBINARY |
VT_ARRAY | VT_BOOL | BOOL_ARRAY | SQL_LONGVARBINARY | |
VT_ARRAY | VT_R4 | REAL_ARRAY | SQL_LONGVARBINARY | |
VT_ARRAY | VT_R8 | DOUBLE_ARRAY | SQL_LONGVARBINARY | |
VT_ARRAY | VT_BSTR | SINT64_ARRAY | SINT64 | SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | UINT64_ARRAY | UINT64 | SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | STRING_ARRAY | STRING Default case if nothing else matches |
SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | INTERVAL_ARRAY | INTERVAL | SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | TIMESTAMP_ARRAY | DATETIME | SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | DATE_ARRAY | DATE | SQL_LONGVARBINARY |
VT_ARRAY | VT_BSTR | TIME_ARRAY | TIME | SQL_LONGVARBINARY |
As the table shows, CIM supports multiple array types. These array types are returned as binary data. However, through ODBC, these array values can also be returned as ASCII strings. For example:
Use SQLColumns to get the data source-dependent type in order to distinguish between [-3][200][50][45] as an array of integers and an array of strings (which just look like numbers).
If an array name or value contains a left or right square bracket within itself, the brackets are doubled in the ASCII representation. For example, fr[ed]dy is shown as:
[fr[[ed]]dy]
CIM class and property qualifiers that change with the instance of a class are not exposed.
CIM associations are only exposed insofar as they are represented by classes. Thus, foreign keys are not used in a table to relate the classes of an association.
An ODBC data source can include several databases. See Connecting to a Data Source for information on database configuration.