Commit 97a4728c authored by Vadim Zeitlin's avatar Vadim Zeitlin

Remove loop that could be never executed from ODBC code

The hasVectorUseElements_ field is guaranteed to be false in the "else"
branch of "if (hasVectorUseElements_)" condition, so the loop condition
testing it could never be true.

Simplify code by getting rid of the loop, without changing its
behaviour.
parent 1a0eeb18
......@@ -184,20 +184,15 @@ odbc_statement_backend::execute(int number)
}
else // We need to retrieve the number of rows affected explicitly.
{
rowsAffected_ = 0;
do {
SQLLEN res = 0;
rc = SQLRowCount(hstmt_, &res);
if (is_odbc_error(rc))
{
throw odbc_soci_error(SQL_HANDLE_STMT, hstmt_,
"getting number of affected rows");
}
rowsAffected_ += res;
SQLLEN res = 0;
rc = SQLRowCount(hstmt_, &res);
if (is_odbc_error(rc))
{
throw odbc_soci_error(SQL_HANDLE_STMT, hstmt_,
"getting number of affected rows");
}
// Move forward to the next result if executing a bulk operation.
while (hasVectorUseElements_ && SQLMoreResults(hstmt_) == SQL_SUCCESS);
rowsAffected_ = res;
}
SQLSMALLINT colCount;
SQLNumResultCols(hstmt_, &colCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment