SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement. - Mailing list pgsql-odbc

From Przemyslaw Rzepecki
Subject SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
Date
Msg-id 1385453596.4529.206.camel@salti.rnd.ki.sw.ericsson.se
Whole thread Raw
Responses Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
List pgsql-odbc
Hi,

I have encountered some problems with SQLFetchScroll when
SQL_ATTR_ROWS_FETCHED_PTR attribute is set. The statement is closed
after first call to SQLFetchScroll. This first call is successful the
numbers of fetched rows correct, but the statement handle, is after the
call, invalid and can not be used in any other SQLFetchScroll calls.

// table test with 'id' integer column and 20 rows.
The code looks like that:
alloc_stmt(hdbc, &hstmt);
SQLPrepare(hstmt, (SQLCHAR *)"select * from test", SQL_NTS);
SQLExecute(hstmt);
SQLSetStmtAttr(hstmt, SQL_ATTR_ROWS_FETCHED_PTR, &rowsFetched, 0);
SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, 1, 0);
SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_STATUS_PTR, rowStatus, 0);
SQLBindCol(hstmt, 1, SQL_C_LONG, idout, sizeof(SQLINTEGER), indicator);
SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
// all above is success and  rowStatus and idout arrays are correctly
// updated.

SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
// fails with error INVALID HANDLE

Is my usage of the fetch scroll function incorrect?

I am using unixODBC version: 2.3.1
with psqlodbc-09.02.0100 driver
and Postgresql 9.3.1 server.

Kind regards,
Przemyslaw





pgsql-odbc by date:

Previous
From: Przemyslaw Rzepecki
Date:
Subject: Re: SQLCopyDesc to copy rows between tables
Next
From: "thatsmeneo ."
Date:
Subject: psqlodbc library