ODBC Users` Manual

Add to My manuals
280 Pages

advertisement

ODBC Users` Manual | Manualzz

SQLFetchScroll

SQLFetchScroll

SQLFetchScroll() fetches the specified rowset of data from the result set and returns data for all bound columns. Rowsets can be specified at an absolute or relative position.

Syntax

SQLRETURN SQLFetchScroll(SQLHSTMT stmt,

SQLSMALLINT fOrient,

SQLINTEGER fOffset)

Arguments

Data Type

SQLHSTMT

SQLSMALLINT

Argument stmt fOrient

In/Out

Input

Input

SQLINTEGER fOffset Input

Description

Statement handle

Type of fetch, This argument determines scroll direction.SQL_FETCH_NEXTSQL_FETCH_PRIO

RSQL_FETCH_FIRSTSQL_FETCH_LASTSQL

_FETCH_ABSOLUTESQL_FETCH_RELATIV

E

Number rows to fetch

Return Values

SQL_SUCCESS

SQL_SUCCESS_WITH_INFO

SQL_INVALID_HANDLE

SQL_ERROR

SQL_NO_DATA_FOUND

Description

SQLFetchScroll() fetches the specified rowset of data from the result set and returns data for all bound columns. Rowsets can be specified at an absolute or relative position.

You can set the cursor direction like followings;

SQL_FETCH_NEXT

ODBC Users’ Manual 78

SQLFetchScroll

Return the next rowset. This is equivalent to calling SQLFetch(). SQLFetchScroll() ignores the value of

FetchOffset.

SQL_FETCH_PRIOR

Return the prior rowset. SQLFetchScroll() ignores the value of FetchOffset.

SQL_FETCH_RELATIVE

Return the rowset FetchOffset from the start of the current rowset.

SQL_FETCH_ABSOLUTE

Return the rowset starting at row FetchOffset.

SQL_FETCH_FIRST

Return the first rowset in the result set. SQLFetchScroll() ignores the value of FetchOffset.

SQL_FETCH_LAST

Return the last complete rowset in the result set. SQLFetchScroll() ignores the value of FetchOffset.

Diagnosis

SQLSTATE

01004

Description

String data, right truncated

08S01 Communication channel error

Comments

String or binary data returned for a column resulted in the truncation of nonblank character or non-NULL binary data. If it was a string value, it was right-truncated.

Communication channel failure before the function processing is completed between the ODBC and the database

HY000 General error

Related Functions

SQLFetch

Example

SQLFetchScroll(stmt , SQL_FETCH_RELATIVE, 10);

79 ODBC Functions

advertisement

advertisement

Table of contents