Core subroutine
Return the number of columns in a result set.
call EDSNumResultCols(HSTMT_IV,NUMCOLS_IV)
•HSTMT_IV An input integer value that indicates the statement handle.
•NUMCOLS_IV An output integer value indicating the number of columns in the result set.
Description
For a prepared statement, your application can call EDSNumResultCols after it calls EDSPrepare and before or after it calls EDSExecute. For a direct statement, your application can call EDSNumResultCols after it calls EDSExecDirect.
If the statement associated with the statement handle does not return columns, EDSNumResultCols sets NUMCOLS_IV to zero.
Return Values
EDSNumResultCols returns EDS_SUCCESS, EDS_ERROR, or EDS_INVALID_HANDLE.
When EDSNumResultCols 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 EDSNumResultCols.
The following table lists possible SQLSTATE values:
SQL STATE |
Error |
Description |
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. |
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
EDSDescribeCol returns information (such as size and type) about a result column.
EDSBindCol allocates an ESL variable for a column in the result set.
EDSFetch retrieves rows in the result set.
EDSGetData retrieves a column with a large data value.
EDSSetScrollOptions and EDSExtendedFetch retrieve rows using a scrollable cursor.