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:
parent
4dacf1488d
commit
0646d1131b
@ -1592,7 +1592,7 @@ bool QODBCResult::exec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
r = SQLExecute(d->hStmt);
|
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);
|
qWarning() << "QODBCResult::exec: Unable to execute statement:" << qODBCWarn(d);
|
||||||
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
|
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
|
||||||
"Unable to execute statement"), QSqlError::StatementError, d));
|
"Unable to execute statement"), QSqlError::StatementError, d));
|
||||||
|
@ -1030,6 +1030,10 @@ void tst_QSqlQuery::isActive()
|
|||||||
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
|
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
|
||||||
|
|
||||||
QVERIFY( q.isActive() );
|
QVERIFY( q.isActive() );
|
||||||
|
|
||||||
|
QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) );
|
||||||
|
|
||||||
|
QVERIFY( q.isActive() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QSqlQuery::numRowsAffected()
|
void tst_QSqlQuery::numRowsAffected()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user