ODBC: fixed consistence of return of QODBCResult::exec()

The QODBCResult::exec() returns false when query is an delete
with no data do delete caused by SQLExecute function returning
SQL_NO_DATA, but the false return means error on execution.

Task-number:  QTBUG-10569
Change-Id: I6c7ebadcf62ab404b60c7bcccdab6a10bf16a923
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
Israel Lins 2013-03-17 23:23:15 -03:00 committed by The Qt Project
parent 4dacf1488d
commit 0646d1131b
2 changed files with 5 additions and 1 deletions

View File

@ -1592,7 +1592,7 @@ bool QODBCResult::exec()
}
}
r = SQLExecute(d->hStmt);
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
qWarning() << "QODBCResult::exec: Unable to execute statement:" << qODBCWarn(d);
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
"Unable to execute statement"), QSqlError::StatementError, d));

View File

@ -1030,6 +1030,10 @@ void tst_QSqlQuery::isActive()
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
QVERIFY( q.isActive() );
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
QVERIFY( q.isActive() );
}
void tst_QSqlQuery::numRowsAffected()