Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Nick Gorham <nick(at)lurcher(dot)org>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.
Date: 2014-03-07 09:59:28
Message-ID: 53199880.1060107@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On 03/07/2014 11:48 AM, Nick Gorham wrote:
> I hope you don't mind me posting to your list as a observer, but I
> noticed the following in the original code
>
> SQLINTEGER int_array[ARRAY_SIZE];
>
> /* Bind */
> rc = SQLBindCol(hstmt, 1, SQL_INTEGER, int_array, sizeof(SQLLEN),
> ind_array);
> CHECK_STMT_RESULT(rc, "SQLBindCol failed", hstmt);
>
> I would have thought
>
> /* Bind */
> rc = SQLBindCol(hstmt, 1, SQL_INTEGER, int_array,
> sizeof(SQLINTEGER), ind_array);
> CHECK_STMT_RESULT(rc, "SQLBindCol failed", hstmt);
>
> Was what it should have been. The driver will have written past the end
> of int_array, and overwritten the handle (I guess).

The buffer-length argument is ignored with fixed-length data. Although I
agree on readability grounds that it should be sizeof(SQLINTEGER), to
match SQL_INTEGER, or 0 to make it clear that it's ignored.

- Heikki

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Itnal, Prakash (NSN - IN/Bangalore) 2014-03-07 11:43:22 09.03.0100 is not compatible with Postgres-9.1.x
Previous Message Nick Gorham 2014-03-07 09:48:15 Re: SQLFetchScroll with SQL_ATTR_ROWS_FETCHED_PTR closing statement.