Core subroutine
Return the result descriptor for one column.
call EDSDescribeCol(HSTMT_IV, COLNUM_IV, COLINFO_STRUCT )
•HSTMT_IV An input integer value that indicates the statement handle.
•COLNUM_IV An input integer value that indicates the column number (in left-to-right order within the result set, starting with 1).
•COLINFO_STRUCT An output EDSCOLDEF_STRUCT structure that indicates the descriptor structure for the column of data.
Description
Your application can call EDSDescribeCol typically after a call to EDSPrepare and before or after the associated call to EDSExecute. Your application can also call EDSDescribeCol after a call to EDSExecDirect.
EDSDescribeCol retrieves the column name, type, and length generated by a SELECT statement. If the name of the column is an expression, then COLINFO.COLUMN_NAME is either an empty string or a driver-defined name.
Note: ODBC supports EDS_NULLABLE_UNKNOWN as an extension, even though X/Open and the SQL Access Group do not specify the option for the ODBC function SQLDescribeCol, upon which EDSDescribeCol is based.
Return Values
EDSDescribeCol returns EDS_SUCCESS, EDS_SUCCESS_WITH_INFO, EDS_INVALID_HANDLE, or EDS_ERROR.
When EDSDescribeCol 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 EDSDescribeCol.
The following table lists possible SQLSTATE values.
SQL STATE |
Error |
Description |
24000 |
Invalid cursor state |
The statement associated with the statement handle did not return a result set. There were no columns to describe. |
IM001 |
Driver does not support this function |
The driver associated with 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. |
S1002 |
Invalid column number |
The value specified for the argument COLNUM_IV was 0. The value specified for the argument COLNUM_IV was greater than the number of columns in the result set. |
S1008 |
Operation cancelled |
Asynchronous processing was enabled for the statement handle. 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 |
The function was called prior to calling EDSPrepare or EDSExecDirect for the statement handle. 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
EDSBindCol defines an ESL variable for a column in a result set.
EDSCancel cancels statement processing.
EDSColAttributes returns information about a column in a result set.
EDSFetch fetches a row of data.
EDSPrepare prepares a statement for execution.