ODBC_SQLColAttribute

4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next

version 2004


ODBC_SQLColAttribute (stmtID; colNb; fieldIdentifier; characterAttrPtr) Longint

ParameterTypeDescription
stmtIDLongintStatement ID
colNbLongintNumber of the record from which the field value
is to be retrieved
fieldIdentifierLongintField identifier in row colNb that is to be returned
characterAttrPtrPointerValue in the fieldID field of the colNb row if the
field is a character string.
Otherwise, the field is unused
Function resultLongintReturns the result of the MS ODBC API function
SQLColAttribute

Description

The ODBC_SQLColAttribute command returns descriptor information for a column in a result set.

stmtID is a valid statement ID returned by ODBC_SQLAllocStmt.

colNb is the number of the column from which the field value is to be retrieved.

fieldIdentifier defines which field in row colNb to be returned, which can be one of the following values:

ConstantDescription
SQL_DESC_AUTO_UNIQUE_VALUE SQL_TRUE if the column is an autoincrementing
column. SQL_FALSE if the column is not an
autoincrementing column or is not numeric.
SQL_DESC_BASE_COLUMN_NAMEThe base column name for the result set column.
SQL_DESC_BASE_TABLE_NAMEName of the base table that contains the column.
SQL_DESC_CASE_SENSITIVE SQL_TRUE if the column is treated as case-sensitive
for collations and comparisons. SQL_FALSE if the
column is not treated as case-sensitive for collations
and comparisons or is noncharacter
SQL_DESC_CATALOG_NAME Catalog of the table that contains the column.
SQL_DESC_CONCISE_TYPEConcise data type.
SQL_DESC_COUNT Number of columns available in the result set.
SQL_DESC_DISPLAY_SIZE Maximum number of characters required to display
data from the column.
SQL_DESC_DISPLAY_SIZEMaximum number of characters required to display
data from the column.
SQL_DESC_FIXED_PREC_SCALESQL_TRUE if the column has a fixed precision and
nonzero scale that are data source–specific.
SQL_FALSE if the column does not have a fixed
precision and nonzero scale that are data
source-specific.
SQL_DESC_LABELColumn label or title.
SQL_DESC_LENGTH A numeric value that is either the maximum or actual
character length of a character string or binary data type.
SQL_DESC_LITERAL_PREFIXCharacter or characters that the driver recognizes as a
prefix for a literal of this data type.
SQL_DESC_LITERAL_SUFFIXCharacter or characters that the driver recognizes as a
suffix for a literal of this data type.
SQL_DESC_LOCAL_TYPE_NAMEAny localized (native language) name for the data type
that may be different from the regular name of the
data type.
SQL_DESC_NAME Column alias, if it applies.
SQL_DESC_NULLABLE SQL_ NULLABLE if the column can have NULL
values;
SQL_NO_NULLS if the column does not have NULL
values; or SQL_NULLABLE_UNKNOWN if it is not
known whether the column accepts NULL values.
SQL_DESC_NUM_PREX_RADIXReturns 2 if the field is anapproximate numeric data
type. If the data type is an exact numeric type, it
returns 10 because the SQL_DESC_PRECISION field
contains the number of decimal digits. This field is set
to 0 for all non-numeric data types.
SQL_DESC_OCTET_LENGTHLength, in bytes, of a character string or binary data
type.
SQL_DESC_PRECISION A numeric value that for a numeric data type denotes
the applicable precision.
SQL_DESC_SCALE A numeric value that is the applicable scale for a
numeric data type.
SQL_DESC_SCHEMA_NAME The schema of the table that contains the column.
SQL_DESC_SEARCHABLE SQL_PRED_NONE if the column cannot be used in a
WHERE clause. SQL_PRED_CHAR if the column can
be used in a WHERE clause but only with the LIKE
predicate. SQL_PRED_BASIC if the column can be
used in a WHERE clause with all the comparison
operators except LIKE. SQL_PRED_SEARCHABLE if
the column can be used in a WHERE clause with any
comparison operator.
SQL_DESC_TABLE_NAME Name of the table that contains the column.
SQL_DESC_TYPE Numeric value that specifies the SQL data type.
SQL_DESC_TYPE_NAME Data source–dependent data type name, for example,
"CHAR".
SQL_DESC_UNNAMED If it contains a column alias or a column name,
SQL_NAMED is returned. If there is no column name
or column alias, SQL_UNNAMED is returned.
SQL_DESC_UNSIGNED SQL_TRUE if the column is unsigned (or not
numeric).
SQL_FALSE if the column is signed.
SQL_DESC_UPDATABLE Updatability of the column

characterAttrPtr is a pointer to the value returned based on fieldIdentifier.

For more information, please see the SQLColAttribute function in the MS ODBC API at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlcolattribute.asp.

Function Results

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

Example

The following method returns the name of the second column in the Employee table:

   $result:=ODBC_SQLPrepare ($statementID;"SELECT * FROM Employee") 
   $result:=ODBC_SQLColAttribute ($statementID;2;SQL_DESC_LABEL;->vColumnName)

See Also

ODBC_SQLPrepare.


4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next