Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.0.6, 2.0.18
-
None
Description
For 2nd statement generating affected rows number, SQLRowCount would still return the row count for 1st statement. To repeat
ODBC_TEST(test_multi_statements)
{ SQLLEN num_inserted; SQLRETURN rc; OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS t1"); OK_SIMPLE_STMT(Stmt, "CREATE TABLE t1 (a int)"); OK_SIMPLE_STMT(Stmt, "INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2), (3)"); SQLRowCount(Stmt, &num_inserted); diag("inserted: %ld", (long)num_inserted); FAIL_IF(num_inserted != 1, "Expected 1 row inserted"); rc= SQLMoreResults(Stmt); num_inserted= 0; rc= SQLRowCount(Stmt, &num_inserted); FAIL_IF(num_inserted != 2, "Expected 2 row inserted"); rc= SQLMoreResults(Stmt); FAIL_IF(rc != SQL_NO_DATA, "expected no more results"); return OK; }2nd call of SQLRowCount returns 1