SQLSetPos in the Cursor Library

The cursor library only supports the SQL_POSITION operation for the Operation argument in SQLSetPos. It only supports the SQL_LOCK_NO_CHANGE value for the LockType argument.

If the driver does not support bulk operations, the cursor library returns SQLSTATE HYC00 (Driver not capable) when SQLSetPos is called with RowNumber equal to 0. Note that this driver behavior is not recommended. Support for bulk operations will be mandatory in the future.

The cursor library does not support the SQL_UPDATE and SQL_DELETE operations in a call to SQLSetPos. The cursor library implements a positioned update or delete SQL statement by creating a searched update or delete statement with a WHERE clause that enumerates the values stored in its cache for each bound column. For more information, see “Processing Positioned Update and Delete Statements” earlier in this appendix.

If the driver does not support static cursors, an application working with the cursor library should only call SQLSetPos on a rowset fetched by SQLExtendedFetch or SQLFetchScroll, not SQLFetch. The cursor library implements SQLExtendedFetch and SQLFetchScroll by making repeated calls of SQLFetch (with a rowset size of 1) in the driver. The cursor library passes calls to SQLFetch, on the other hand, through to the driver. If SQLSetPos is called on a multi-row rowset fetched by SQLFetch when the driver does not support static cursors, the call will fail because SQLSetPos does not work with forward-only cursors. This will occur even if an application has successfully called SQLSetStmtAttr to set SQL_ATTR_CURSOR_TYPE to SQL_CURSOR_STATIC, which the cursor library supports even if the driver does not support static cursors.