summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2010-01-05 01:47:40 (GMT)
committerBill King <bill.king@nokia.com>2010-01-05 01:47:40 (GMT)
commit4520a644f3bb82c650db8280a812fcd67ad815bf (patch)
tree9ad9f2105ed7d84c881983060a0c52aed39d706e /src/sql
parentb72d504e686f0c51c3afef2cc34baa1436cb90e1 (diff)
downloadQt-4520a644f3bb82c650db8280a812fcd67ad815bf.zip
Qt-4520a644f3bb82c650db8280a812fcd67ad815bf.tar.gz
Qt-4520a644f3bb82c650db8280a812fcd67ad815bf.tar.bz2
(ODBC) Handle drivers that return SQL_NO_DATA for exec success.
Most drivers return SQL_SUCCESS when executing a delete statement for example, but FreeTDS returns SQL_NO_DATA, which is technically correct, but doesn't follow the practice of other drivers. Task-number: QTBUG-4896 Reviewed-by: Justin McPherson
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index fdf0c2c..55f0696 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -888,12 +888,17 @@ bool QODBCResult::reset (const QString& query)
(SQLCHAR*) query8.constData(),
(SQLINTEGER) query8.length());
#endif
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r!= SQL_NO_DATA) {
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
"Unable to execute statement"), QSqlError::StatementError, d));
return false;
}
+ if(r == SQL_NO_DATA) {
+ setSelect(false);
+ return true;
+ }
+
SQLINTEGER isScrollable, bufferLength;
r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength);
if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)