Please enable JavaScript to view this site.

ESL Documentation

Level 1 subroutine

Return information about data types supported by a data source.

call EDSGetTypeInfo(HSTMT_IV, SQLTYPE_IV, MAXROWS_IV, NUMROWS_IV, ARRAY_STRUCT) 

HSTMT_IV An input integer value indicating the statement handle.

SQLTYPE_IV An input integer value indicating one of the valid ODBC SQL data types:

EDS_SQL_BIGINT

EDS_SQL_BINARY

EDS_SQL_BIT

EDS_SQL_CHAR

EDS_SQL_DATE

EDS_SQL_DECIMAL

EDS_SQL_DOUBLE

EDS_SQL_FLOAT

EDS_SQL_INTEGER

EDS_SQL_LONGVARBINARY

EDS_SQL_LONGVARCHAR

EDS_SQL_NUMERIC

EDS_SQL_REAL

EDS_SQL_SMALLINT

EDS_SQL_TIME

EDS_SQL_TIMESTAMP

EDS_SQL_TINYINT

EDS_SQL_VARBINARY

EDS_SQL_VARCHAR or EDS_ALL_TYPES to describe all types

MAXROWS_IV An input integer value indicating the maximum number of rows in the result array.

NUMROWS_IV An output integer value indicating the actual number of rows returned.

ARRAY_STRUCT An output array of EDSTYPE_STRUCT structures that contain information about the specified type.

Description

EDSGetTypeInfo returns the following information for each requested data type. The information for each type is contained in an EDSTYPE_STRUCT structure. For more than one type, EDSGetTypeInfo returns an array of EDSTYPE structures, ordered by DATA_TYPE and TYPE_NAME.

Field

Type

Contents

TYPE_NAME

string

Data source-dependent data type name; for example, "CHAR", "VARCHAR", "MONEY", "LONG VARBINARY", or "CHAR() FOR BIT DATA". The embedded parentheses allow applications to indicate where to insert the value in CREATE_PARAMS into TYPE_NAME. If there are no embedded parentheses, CREATE_PARAMS follows TYPE_NAME.

DATA_TYPE

integer

ODBC SQL data type number from the list of all data types in Appendix C, "Data Types."

MAX_LENGTH

integer

Maximum length allowed for this data type. EDS_NULL is returned for data types where precision is not applicable. For more information, refer to Appendix C, "Data Type Definitions."

LITERAL_PREFIX

string

Character or characters used to prefix a literal; for example, an apostrophe (') for character types or 0x for binary. EDS_NULL is returned for data types where a literal prefix is not applicable.

LITERAL_SUFFIX

string

Character or characters used to terminate a literal; for example, an apostrophe (') for character types, nothing for binary. EDS_NULL is returned for data types where a literal suffix is not applicable.

CREATE_PARAMS

string

Parameters for this data type, in the form of a string. For example, CREATE_PARAMS for DECIMAL would be "precision, scale"; CREATE_PARAMS for FLOAT, would equal NULL, and CREATE_PARAMS for VARCHAR would equal "max length". EDS_NULL is returned if there are parameters for the data type definition. The driver supplies the text in CREATE_PARAMS in the language used in the local country (for example, France).

NULLABLE

integer

Whether the data type accepts a NULL value: EDS_NO_NULLS if the data type does not accept NULL values. EDS_NULLABLE if the data type accepts NULL values. EDS_NULLABLE_UNKNOWN if it is not known if the column accepts NULL values.

CASE_SENSITIVE

integer

Whether the data type can be treated as case-sensitive for collations: EDS_TRUE if the data type can be case-sensitive. EDS_FALSE if the data type cannot be case-sensitive.

SEARCHABLE

integer

How the data type is used in a WHERE clause: EDS_UNSEARCHABLE if the data type cannot be used in a WHERE clause. EDS_LIKE_ONLY if the data type can be used in a WHERE clause only with the LIKE predicate. EDS_ALL_EXCEPT_LIKE if the data type can be used in a WHERE clause with all comparison operators except LIKE. EDS_SQL_SEARCHABLE if the data type can be used in a WHERE clause with any comparison operator.

UNSIGNED_ATTRIBUTE

integer

Whether the data type is unsigned: EDS_TRUE if the data type is unsigned. EDS_FALSE if the data type is signed. EDS_NULL is returned if the attribute is not applicable to the data type.

MONEY

integer

Whether the data type is a money data type: EDS_TRUE if it is a money data type. EDS_FALSE if it is not a money data type.

AUTO_INCREMENT

integer

Whether the data type is auto incrementing: EDS_TRUE if the data type is auto incrementing. EDS_FALSE if the data type is not auto incrementing. EDS_NULL if the attribute is not applicable to the data type. Your application can insert values into a column having this attribute, but cannot update the values in the column. This attribute is valid only for numeric data types.

LOCAL_TYPE_NAME

string

Localized version of the data source-dependent name of the data type. EDS_NULL is returned if a localized name is not supported by the data source.

 

Attribute information can apply to data types or to specific columns in a result set. EDSGetTypeInfo returns information about attributes associated with data types; EDSColAttributes returns information about attributes associated with columns in a result set.

Return Values

EDSGetTypeInfo returns EDS_SUCCESS, EDS_INVALID_HANDLE, or EDS_ERROR.

When EDSGetTypeInfo returns EDS_ERROR, you can obtain an associated SQLSTATE value with more specific information by calling EDSError. The following table lists each typical SQLSTATE value and explains each one in the context of the command EDSGetTypeInfo.

The following table lists possible SQLSTATE values:

SQL

STATE

Error

Description

08S01

Communication link failure

The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.

24000

Invalid cursor state

Results were pending on the statement handle from a previous SELECT statement or a cursor associated with the statement handle had not been closed.

IM001

Driver does not support this function

The driver corresponding to the statement handle does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by EDSError in the argument ERRORTEXT describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate the memory required to support execution or completion of the function.

S1004

SQL data type out of range

An invalid SQLTYPE_IV was specified.

S1008

Operation cancelled

Asynchronous processing was enabled for the statement handle, then the function was called, and before it completed execution, EDSCancel was called on the statement handle. Then the function was called again on the statement handle.

S1010

Function sequence error

An asynchronously executing function (not this one) was called for the statement handle and was still executing when this function was called.

S1T00

Timeout expired

The timeout period expired before the data source returned the result set. The timeout period is set through EDSSetStmtOption, EDS_QUERY_TIMEOUT.

See Also

EDSGetInfo returns general information about the driver and the data source.