diff options
author | Bill King <bill.king@nokia.com> | 2009-12-08 09:04:03 +1000 |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-12-08 09:04:03 +1000 |
commit | 12b032ca7c79955f03f744bdb8f7b0d60e222e40 (patch) | |
tree | ecdbf6e63fa2b2c507337c102f597c0462d78117 /src/sql/drivers | |
parent | 0a4f8a73165da5ec274409dffa1de921421d9bb1 (diff) | |
download | qt4-tools-12b032ca7c79955f03f744bdb8f7b0d60e222e40.tar.gz |
Proper fix for QTBUG-6421
fixes setForwardOnly() for both OCI and SQLite
Task-number: QTBUG-6421
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/sql/drivers')
-rw-r--r-- | src/sql/drivers/sqlite/qsql_sqlite.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 8355de2921..c62f15cfa8 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -122,14 +122,14 @@ public: sqlite3_stmt *stmt; - uint skippedStatus: 1; // the status of the fetchNext() that's skipped - uint skipRow: 1; // skip the next fetchNext()? - uint utf8: 1; + bool skippedStatus; // the status of the fetchNext() that's skipped + bool skipRow; // skip the next fetchNext()? QSqlRecord rInf; + QVector<QVariant> firstRow; }; QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res) : q(res), access(0), - stmt(0), skippedStatus(false), skipRow(false), utf8(false) + stmt(0), skippedStatus(false), skipRow(false) { } @@ -189,10 +189,17 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i // already fetched Q_ASSERT(!initialFetch); skipRow = false; + for(int i=0;i<firstRow.count();i++) + values[i]=firstRow[i]; return skippedStatus; } skipRow = initialFetch; + if(initialFetch) { + firstRow.clear(); + firstRow.resize(sqlite3_column_count(stmt)); + } + if (!stmt) { q->setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult", "Unable to fetch row"), QCoreApplication::translate("QSQLiteResult", "No query"), QSqlError::ConnectionError)); @@ -399,7 +406,7 @@ bool QSQLiteResult::exec() "Parameter count mismatch"), QString(), QSqlError::StatementError)); return false; } - d->skippedStatus = d->fetchNext(cache(), 0, true); + d->skippedStatus = d->fetchNext(d->firstRow, 0, true); if (lastError().isValid()) { setSelect(false); setActive(false); |