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

From Heikki Linnakangas
Subject Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
Date
Msg-id 5315E154.3080406@vmware.com
Whole thread Raw
In response to SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.  (Przemyslaw Rzepecki <przemyslaw.rzepecki@ericsson.com>)
Responses Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.  (Przemyslaw Rzepecki <przemyslaw.rzepecki@ericsson.com>)
List pgsql-odbc
On 11/26/2013 10:13 AM, Przemyslaw Rzepecki wrote:
> 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?

Looks correct to me. I tried to reproduce this with the attached test
program (modified from the regression tests), and it worked fine.

- Heikki

Attachment

pgsql-odbc by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Code inconsistency in convert.c for guid -> string conversion
Next
From: Heikki Linnakangas
Date:
Subject: Re: SQLGetTypeInfo does not return COLUMN_SIZE