Conformance
Version Introduced: ODBC 1.0
Standards Compliance: ISO 92
Summary
f90SQLGetCursorName returns the cursor name associated with a specified statement.
Syntax
| f90SQLGetCursorName | (StatementHandle,CursorName, CursorNameStrLength, iRet) |
| integer(SQLHSTMT_KIND),intent(in):: | StatementHandle |
| character(len=*),intent(in):: | CursorName |
| integer(SQLSMALLINT_KIND):: | CursorNameStrLength |
| integer(SQLRETURN_KIND),intent(out):: | iRet |
Arguments
StatementHandle [Input]
Statement handle.
CursorName [Output]
Buffer in which to return the cursor name.
CursorNameStrLength [Output]
Buffer in which to return the total number of bytes (excluding the null-termination character) available to return in CursorName. If the number of bytes available to return is greater than or equal to Len(CursorName), the cursor name in CursorName is truncated to Len(CursorName) minus the length of a null-termination character.
iRet [Output]
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
Diagnostics
When f90SQLGetCursorName returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling f90SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. The following table lists the SQLSTATE values commonly returned by f90SQLGetCursorName and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
| SQLSTATE | Error | Description |
| 01000 | General warning | Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.) |
| 01004 | String data, right truncated | The buffer CursorName was not large enough to return the entire cursor name, so the cursor name was truncated. The length of the untruncated cursor name is returned in CursorNameStrLength. (Function returns SQL_SUCCESS_WITH_INFO.) |
| HY000 | 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 f90SQLGetDiagRec in the MessageText buffer describes the error and its cause. |
| HY001 | Memory allocation error | The driver was unable to allocate memory required to support execution or completion of the function. |
| HY010 | Function sequence error | (DM) An asynchronously executing function was
called for the StatementHandle and was still executing when this function was
called. (DM) f90SQLExecute, f90SQLExecDirect, f90SQLBulkOperations, or f90SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns. |
| HY013 | Memory management error | The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions. |
| HY015 | No cursor name available | (DM) The driver was an ODBC 2.x driver, there was no open cursor on the statement, and no cursor name had been set with f90SQLSetCursorName. |
| HY090 | Invalid string or buffer length | (DM) The value specified in the argument CursorNameBufferLength was less than 0. |
| HYT01 | Connection timeout expired | The connection timeout period expired before the data source responded to the request. The connection timeout period is set through f90SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT. |
| IM001 | Driver does not support this function | (DM) The driver associated with the StatementHandle does not support the function. |
Comments
Cursor names are used only in positioned update and delete statements (for example, UPDATE table-name ...WHERE CURRENT OF cursor-name). If the application does not call f90SQLSetCursorName to define a cursor name, the driver generates a name. This name begins with the letters SQL_CUR.
Note: In ODBC 2.x, when there was no open cursor, and no name had been set by a call to f90SQLSetCursorName, a call to f90SQLGetCursorName returned SQLSTATE HY015 (No cursor name available). In ODBC 3.x, this is no longer true; regardless of when f90SQLGetCursorName is called, the driver returns the cursor name.
f90SQLGetCursorName returns the name of a cursor regardless of whether the name was created explicitly or implicitly. A cursor name is implicitly generated if f90SQLSetCursorName is not called. f90SQLSetCursorName can be called to rename a cursor on a statement as long as the cursor is in an allocated or prepared state.
A cursor name that is set either explicitly or implicitly remains set until the StatementHandle with which it is associated is dropped, using f90SQLFreeHandle with a HandleType of SQL_HANDLE_STMT.
Related Subroutines
| For information about | See |
| Executing an SQL statement | f90SQLExecDirect |
| Executing a prepared SQL statement | f90SQLExecute |
| Preparing a statement for execution | f90SQLPrepare |
| Setting a cursor name | f90SQLSetCursorName |