Re: Bug in SQLRowCount ?

Clemens Ladisch <[email protected]>
Newsgroups gmane.comp.db.postgresql.odbc
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.