SQLColAttribute supports several ODBC Driver for Teradata-defined column attributes as the FieldIdentifier argument. Additionally, using SQL_COLUMN_NAME returns the database TITLE (if available) instead of the name because this makes most report writers work more sensibly.
When using SQLColAttribute to obtain driver-defined attribute values, the type of the attribute must be specified in the BufferLength argument. In addition, SQLColAttribute returns the value through one of two pointers depending on the type: Integer information is returned in *NumericAttributePtr as a SQLLEN value; all other formats of information are returned in *CharacterAttributePtr. The pointer not being used for a particular attribute should be set to NULL in the call. For example, to obtain the value of the attribute SQL_DESC_TD_ODBC_TYPE:
rc = SQLColAttribute(hstmt, colno, SQL_DESC_TD_ODBC_TYPE, NULL, SQL_IS_SMALLINT, NULL, &NumAttrPtr);
The pointer used for each attribute defined by ODBC Driver for Teradata is indicated in the following table.
FieldIdentifier | Value Returned In | Description |
---|---|---|
SQL_COLUMN_ACTIVITY_TYPE | NumericAttributePtr | Integer that specifies the kind of SQL statement executed. |
SQL_COLUMN_COST_ESTIMATE | NumericAttributePtr | Integer with a cost estimate for running the SQL statement. The value returned represents the time estimate in seconds. |
SQL_COLUMN_FORMAT | CharacterAttributePtr | Returns the Teradata FORMAT clause associated with the column. |
SQL_COLUMN_ACTUAL_NAME | CharacterAttributePtr | Name associated with the result column. This FieldIdentifier value is necessary because the meaning of SQL_COLUMN_NAME has changed. |
SQL_COLUMN_CHARACTER_SET | NumericAttributePtr | Integer containing the character set of the column. |
SQL_COLUMN_EXPORT_WIDTH | NumericAttributePtr | Integer containing the database export width for character columns. |
SQL_COLUMN_EXPORT_WIDTH_ADJ | NumericAttributePtr | Integer containing the database export width adjustment for character columns. |
SQL_COLUMN_EXPORT_BYTES | NumericAttributePtr | Integer containing the number of bytes that the database provides for a character column. |
SQL_DESC_TD_ODBC_TYPE | NumericAttributePtr | An SQLSMALLINT that contains the Teradata ODBC-specific SQL data type code. If multiple database types have the same standard ODBC SQL type, then the Teradata ODBC-specific SQL data type code can be used to distinguish between the types. |
For more information about these attributes, see SQL Descriptor Fields.