mirror of
https://github.com/allankoechke/soci.git
synced 2026-11-30 10:58:24 +00:00
Fix ODBC backend get_affected_rows() when using FreeTDS driver.
SQLRowCount() doesn't return the correct number of rows affected for vector operations when using FreeTDS 0.91 (it seems to always return 1 instead of the real number of elements). Avoid using this function entirely as we already have the number of affected rows anyhow, via SQL_ATTR_PARAMS_PROCESSED_PTR. This is simpler, probably more efficient and works with both the native Microsoft ODBC driver and FreeTDS.
This commit is contained in:
@@ -180,9 +180,12 @@ odbc_statement_backend::execute(int number)
|
||||
throw odbc_soci_error(SQL_HANDLE_STMT, hstmt_,
|
||||
"Statement Execute");
|
||||
}
|
||||
// We should preserve the number of rows affected here
|
||||
// where we know for sure that a bulk operation was executed.
|
||||
else
|
||||
else if (hasVectorUseElements_)
|
||||
{
|
||||
// We already have the number of rows, no need to do anything.
|
||||
rowsAffected_ = rows_processed;
|
||||
}
|
||||
else // We need to retrieve the number of rows affected explicitly.
|
||||
{
|
||||
rowsAffected_ = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user