Re: Bug in SQLRowCount ? - Mailing list pgsql-odbc

From Clemens Ladisch
Subject Re: Bug in SQLRowCount ?
Date
Msg-id cb8dd59f-bf28-0a40-0639-f3f7856b3ee7@ladisch.de
Whole thread Raw
In response to Re: Bug in SQLRowCount ?  (Jaydip <jaydeep.thakkar92@gmail.com>)
List 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


pgsql-odbc by date:

Previous
From: Jaydip
Date:
Subject: Re: Bug in SQLRowCount ?
Next
From: Ayman Samamry
Date:
Subject: Deadlock when executing multiple select statements from multiplethreads