Bug #92966 ROW_COUNT() returns 0 on insert when using ODBC connector 8.0+
Submitted: 26 Oct 2018 14:03 Modified: 26 Nov 2018 16:42
Reporter: Ben Lu Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:8.0.12 OS:Microsoft Windows (10)
Assigned to: CPU Architecture:Any

[26 Oct 2018 14:03] Ben Lu
Description:
I recently switched my C++ application to use the latest MySQL ODBC connector 8.0.12 from ODBC 3.51. After the switch, I found out that ROW_COUNT() always return 0 on inserts/updates. For example, in my application, it inserted a new row to a table (I verified that the row was inserted), then using the same db connection object, it immediately did a "select ROW_COUNT()". The query returned 0 instead of 1. If I switched back to ODBC 3.51 and tried the same thing, it would return 1.

How to repeat:
You'd need to run these queries using C++ API via ODBC connector 8.0.12 or 8.0.13 -

create table test (bug varchar(255))

insert into test select 'odbc bug';

select row_count();

Suggested fix:
I am suspecting that ODBC implementation might be doing a ping or something like that to MySQL before it executes a new query, causing the affected row count from the previous query to be reset.
[26 Oct 2018 16:42] Miguel Solorzano
Thank you for the bug report. Could you please provide the test code client file which presents this issue (attach it using the Files tab). Thanks.
[27 Nov 2018 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".