diff options
author | Israel Lins <israelins85@yahoo.com.br> | 2013-03-18 02:23:15 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-24 21:57:44 (GMT) |
commit | 5500bdc4f18e2e5b056e8b274dfef389889a5d34 (patch) | |
tree | 4b7dbb5b7ece2b6e461548ceefa46927cbb4b10d | |
parent | dd22022e1b0b1fc9538ae4374477bc2fde00cb85 (diff) | |
download | Qt-5500bdc4f18e2e5b056e8b274dfef389889a5d34.zip Qt-5500bdc4f18e2e5b056e8b274dfef389889a5d34.tar.gz Qt-5500bdc4f18e2e5b056e8b274dfef389889a5d34.tar.bz2 |
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>
(cherry-picked from qtbase commit 0646d1131b4bc65cdd9af29f4ce00fdd2398a3df)
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
-rw-r--r-- | src/sql/drivers/odbc/qsql_odbc.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index f95f40c..5ff8e97 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1598,7 +1598,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)); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 27c28b1..bbb1a8d 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -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() |