The ODBC row status array

The row status array returns the status of each row in the rowset.

You allocate the row status array in your application. Then you specify the address of this array with the SQL_ATTR_ROW_STATUS_PTR statement attribute. The array must have as many elements as are specified by the SQL_ATTR_ROW_ARRAY_SIZE statement attribute. SQLExtendedFetch(), SQLFetchScroll(), or SQLSetPos() set the values of the row status array, unless those methods are called after the cursor has been positioned by SQLExtendedFetch(). If the value of the SQL_ATTR_ROW_STATUS_PTR statement attribute is a null pointer, SQLExtendedFetch(), SQLFetchScroll(), and SQLSetPos() do not return the row status.

The contents of the row status array buffer are undefined if SQLExtendedFetch() or SQLFetchScroll() does not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO.

The following values are returned in the row status array.
Table 1. Values returned in a row status array
Row status array value Description
SQL_ROW_SUCCESS The row was successfully fetched.
SQL_ROW_SUCCESS_WITH_INFO The row was successfully fetched, but a warning was returned about the row.
SQL_ROW_ERROR An error occurred when the row was fetched.
SQL_ROW_ADDED The row was inserted by SQLBulkOperations(). If the row is fetched again, or is refreshed by SQLSetPos(), its status is SQL_ROW_SUCCESS.

This value is not set by SQLExtendedFetch() or SQLFetchScroll().

Db2 ODBC does not make inserted rows visible to a scrollable cursor result set, so it does not return this value.

SQL_ROW_UPDATED The row was successfully fetched and has changed since it was last fetched from this result set. If the row is fetched again from this result set, or is refreshed by SQLSetPos(), the status changes to the new status for the row.

Db2 ODBC makes updated rows visible if they continue to satisfy the predicate of the query. Therefore, for SQLBulkOperations() or SQLSetPos(), Db2 ODBC can indicate SQL_ROW_UPDATED, and the row can be visible upon refetch. However, Db2 ODBC cannot detect a change in value from the last fetch. It returns SQL_SUCCESS for a fetch.

SQL_ROW_DELETED The row was deleted after it was last fetched from this result set.

Db2 ODBC does not make deleted rows visible to a scrollable cursor result set, so it does not return this value.

SQL_ROW_NOROW The rowset overlapped the end of the result set, and no row was returned that corresponds to the corresponding element of the row status array.