SQLSetStmtAttr (ODBC)

The Microsoft® SQL Server™ ODBC driver does not support the mixed (keyset/dynamic) cursor model. Attempts to set the keyset size using SQL_ATTR_KEYSET_SIZE fail if the value set is not equal to 0.

The application sets SQL_ATTR_ROW_ARRAY_SIZE on all statements to declare the number of rows returned on a SQLFetch or SQLFetchScroll function call. On statements indicating a server cursor, the driver uses SQL_ATTR_ROW_ARRAY_SIZE to determine the size of the block of rows the server generates to satisfy a fetch request from the cursor. Within the block size of a dynamic cursor, row membership and ordering are fixed if the transaction isolation level is sufficient to ensure repeatable reads of committed transactions. The cursor is completely dynamic outside of the block indicated by this value. Server cursor block size is completely dynamic and can be changed at any point in fetch processing.

The SQL Server ODBC driver also supports the following driver-specific statement attributes.

SQL_SOPT_SS_CURSOR_OPTIONS

Specifies whether the driver will use driver-specific performance options on cursors. SQLGetData is not allowed when these options are set. The default setting is SQL_CO_OFF. This options are valid only when connected to SQL Server version 7.0.

ValuePtr value Description
SQL_CO_OFF Default. Disables fast forward-only, read-only cursors and autofetch, enables SQLGetData on forward-only, read-only cursors.
SQL_CO_FFO Enables fast forward-only, read-only cursors, disables SQLGetData on forward-only, read-only cursors.
SQL_CO_AF Enables the autofetch option on any cursor type. When this option is set for a statement handle, SQLExecute or SQLExecDirect generate an implicit SQLFetchScroll(SQL_FIRST). The cursor is opened and the first batch of rows is returned in a single roundtrip to the server.
SQL_CO_FFO_AF Enables fast forward-only cursors with the autofetch option. It is the same as if both SQL_CO_AF and SQL_CO_FFO are specified.

When these options are set, the server closes the cursor automatically when it detects that the last row has been fetched. The application must still call SQLFreeStmt(SQL_CLOSE) or SQLCloseCursor, but the driver does not have to send the close notification to the server.

If the select list contains a text, ntext, or image column, the fast forward-only cursor is converted to a dynamic cursor and SQLGetData is allowed.

SQL_SOPT_SS_REGIONALIZE

The driver uses this attribute to determine data conversion at the statement level. The attribute causes the driver to respect the client locale setting when converting date, time, and currency values to character strings. The conversion is from SQL Server native data types to character strings only.

ValuePtr value Description
SQL_RE_OFF Default. The driver does not convert date, time, and currency data to character string data using the client locale setting.
SQL_RE_ON The driver uses the client locale setting when converting date, time, and currency data to character string data.

Regional conversion settings apply to currency, numeric, date, and time data types. The conversion setting is only applicable to:


Note When the statement option SQL_SOPT_SS_REGIONALIZE is on, the driver uses the locale registry settings for the current user. The driver does not honor the current thread’s locale if the application sets it by, for example, calling SetThreadLocale.

Altering the regional behavior of a data source can cause application failure. An application that parses date strings and expects date strings to appear as defined by ODBC, could be adversely affected by altering this value.


SQL_SOPT_SS_TEXTPTR_LOGGING

Attribute toggles logging of operations on columns containing text or image data. The default behavior is to log these operations (SQL_TL_ON).

ValuePtr value Description
SQL_TL_OFF Disables logging of operations performed on text and image data.
SQL_TL_ON Default. Enables logging of operations performed on text and image data.

SQL_SOPT_SS_HIDDEN_COLUMNS

Exposes, in the result set, columns hidden in a SQL Server SELECT FOR BROWSE statement. The driver does not expose these columns by default.

ValuePtr value Description
SQL_HC_OFF Default. FOR BROWSE columns are hidden from the result set.
SQL_HC_ON Exposes FOR BROWSE columns.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.