From 4efa1ba22825fb9a8be572dbf595cb29a4e4840b Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Mon, 29 Jun 2009 10:59:04 +1000 Subject: bug fix Task-number: 217003 Reviewed-by: Bill King --- src/sql/kernel/qsqlcachedresult.cpp | 5 ++++- tests/auto/qsqlquery/tst_qsqlquery.cpp | 10 ++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp index 3cace06..4b094c6 100644 --- a/src/sql/kernel/qsqlcachedresult.cpp +++ b/src/sql/kernel/qsqlcachedresult.cpp @@ -184,8 +184,11 @@ bool QSqlCachedResult::fetch(int i) if (d->rowCacheEnd > 0) setAt(d->cacheCount()); while (at() < i + 1) { - if (!cacheNext()) + if (!cacheNext()) { + if (d->canSeek(i)) + break; return false; + } } setAt(i); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 825db6c..ed19e91 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -175,13 +175,14 @@ private slots: void emptyTableNavigate(); #ifdef NOT_READY_YET - void task_217003_data() { generic_data(); } - void task_217003(); void task_229811(); void task_229811_data() { generic_data(); } void task_234422_data() { generic_data(); } void task_234422(); #endif + void task_217003_data() { generic_data(); } + void task_217003(); + void task_250026_data() { generic_data("QODBC"); } void task_250026(); void task_205701_data() { generic_data("QMYSQL"); } @@ -299,9 +300,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) tablenames << qTableName( "qtest_lockedtable" ); -#ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); -#endif + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); @@ -2658,7 +2658,6 @@ void tst_QSqlQuery::emptyTableNavigate() } } -#ifdef NOT_READY_YET void tst_QSqlQuery::task_217003() { QFETCH( QString, dbName ); @@ -2685,7 +2684,6 @@ void tst_QSqlQuery::task_217003() QVERIFY_SQL( q, seek( 1 ) ); QCOMPARE( q.value( 0 ).toString(), QString( "Venus" ) ); } -#endif void tst_QSqlQuery::task_250026() { -- cgit v0.12