Re: Bug in SQLRowCount ?

From: Clemens Ladisch <clemens(at)ladisch(dot)de>
To: pgsql-odbc(at)lists(dot)postgresql(dot)org
Subject: Re: Bug in SQLRowCount ?
Date: 2018-04-04 13:02:17
Message-ID: cb8dd59f-bf28-0a40-0639-f3f7856b3ee7@ladisch.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Jaydip wrote:
> I has also face same issue. I am just curious to know, how are you using
> SQL_ATTR_PARAM_STATUS_PTR?

Please note that the mail you were replying to is over five years old.
It is unlikely that the original author still reads this list.

> I have tried to use that in my code and I was incrementing the count based
> on the status "SQL_PARAM_SUCCESS" i.e. 0.
> However, I found that when I send let's say 3 rows in batch and there is no
> row to delete, the status was still "SQL_PARAM_SUCCESS". When I called
> "SQLRowCount" it was returning me 0.

The SQL_ATTR_PARAM_STATUS_PTR array returns whether a statement resulted in
an error. But a WHERE clause that matches zero rows is not considered an
error by the SQL standard.

To find out how many rows were deleted, you _must_ call SQLRowCount.
For a SQL_PARC_BATCH driver, you have to get each row count separately by
calling SQLRowCount/SQLMoreResults in a loop, as documented here:
<https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/multiple-results>

Regards,
Clemens

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Ayman Samamry 2018-04-10 05:51:51 Deadlock when executing multiple select statements from multiple threads
Previous Message Jaydip 2018-04-04 11:59:56 Re: Bug in SQLRowCount ?