SQLSetStmtOption

The SQLSetStmtOption function allows the caller to set various options at the statement level. The following cursor related options are supported.

Option Value
SQL_CONCURRENCY SQL_CONCUR_READ_ONLY
SQL_CONCUR_LOCKING
SQL_CONCUR_ROWVER
SQL_CONCUR_VALUES
SQL_CURSOR_TYPE SQL_CURSOR_FORWARD_ONLY
SQL_CURSOR_STATIC
SQL_CURSOR_KEYSET_DRIVEN
SQL_CURSOR_DYNAMIC
SQL_ROWSET_SIZE Integer value that specifies the number of rows in the rowset, that is the number of rows that are returned by each call to SQLExtendedFetch. The default value is 1.
SQL_BIND_TYPE Integer value that sets the binding orientation to be used when SQLExtendedFetch is called on the associated hstmt. Both column and row bindings are supported.

SQL Server supports read-only static cursors, and these are exposed through the SQL Server driver. Applications that require updatable static cursors should choose the Cursor Library implementation by setting SQL_ODBC_CURSORS to SQL_CUR_USE_ODBC. Cursors that are provided by the Cursor Library are implemented at the client. All the data is cached, and updates and deletes are issued by constructing a WHERE clause that uses the cached values.

Cursors that are implemented at the server (Forward Only, Keyset, Dynamic, Read-only, and Static) can be specified with a concurrency control option of read-only, lock, row version, or row values. Cursors that are implemented by the cursor library can be read-only or row values.

Mixed cursors are not supported. The SQL_KEYSET_SIZE value is automatically converted to zero (0) if a non-zero value is specified.

In SQL Server 6.5, the ODBC SQL Server driver supports the following driver-specific statement options in SQLSetStmtOption and SQLGetStmtOption.

fOption option vParam descriptions
SQL_SOPT_SS_CURRENT_COMMAND
(SQLGetStmtOption only)
The current SQL command number in the batch.

(Similar to dbcurcmd.)

SQL_SOPT_SS_TEXTPTR_LOGGING SQL_TL_OFF. Text and image operations are not logged.

SQL_TL_ON. Text and image operations are logged. (Default.)