Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Przemyslaw Rzepecki <przemyslaw(dot)rzepecki(at)ericsson(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
Date: 2014-03-04 14:21:08
Message-ID: 5315E154.3080406@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
rows_fetched-test.c text/x-csrc 1.6 KB

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Heikki Linnakangas 2014-03-04 14:29:10 Re: SQLGetTypeInfo does not return COLUMN_SIZE
Previous Message Michael Paquier 2014-03-04 00:19:40 Re: Code inconsistency in convert.c for guid -> string conversion