summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorBill King <bking@trolltech.com>2009-09-17 13:15:40 +1000
committerBill King <bking@trolltech.com>2009-09-17 13:15:40 +1000
commit18c0fec3afba909faa341c766f31d679892021db (patch)
tree8562e5947e0a5d1cd2b81618ad277344a98b9391 /src/sql
parent59dbb1b7e737713fc650c25a20967ec26cc3ff3d (diff)
Fixes issue of forward only datasets failing when not set so.
Previously you had to set forward only on non-scrollable datasets explicitly. This queries ODBC, to determine if it's a scrollable dataset, and sets forwardOnly to false if it isn't. Task-number: QT-353 Reviewed-by: Justin McPherson
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index a5c713d6a1..6a33d1e92c 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -781,6 +781,11 @@ bool QODBCResult::reset (const QString& query)
return false;
}
+ 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)
+ setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
+
SQLSMALLINT count;
SQLNumResultCols(d->hStmt, &count);
if (count) {
@@ -1407,6 +1412,11 @@ bool QODBCResult::exec()
return false;
}
+ 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)
+ setForwardOnly(isScrollable==SQL_NONSCROLLABLE);
+
SQLSMALLINT count;
SQLNumResultCols(d->hStmt, &count);
if (count) {