diff options
author | Bill King <bill.king@nokia.com> | 2009-12-04 00:48:37 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-12-04 00:48:37 (GMT) |
commit | 1d6be599f5c12e9ce23bbdf081a103aa62618e15 (patch) | |
tree | da6a7d84b59a3ed9b2f090c5356ba6106ea70ff5 /tests/auto/qsqlquery | |
parent | a2eda737c58434ee2604b6466dcf3212a35b604f (diff) | |
download | Qt-1d6be599f5c12e9ce23bbdf081a103aa62618e15.zip Qt-1d6be599f5c12e9ce23bbdf081a103aa62618e15.tar.gz Qt-1d6be599f5c12e9ce23bbdf081a103aa62618e15.tar.bz2 |
Fixes: QOCI setForwardOnly(true) accumulating values.
readPiecewise() is assuming an empty valueCache when reading a new row.
setForwardOnly(true) means that only one row is used/re-used. The value
cache wasn't being cleared out when moving to a new row, so the above
assumption was invalid.
Task-number: QTBUG-6421
Reviewed-by: Justin McPherson
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 4264a70..a8908fd 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -199,6 +199,8 @@ private slots: void QTBUG_5251_data() { generic_data("QPSQL"); } void QTBUG_5251(); + void QTBUG_6421_data() { generic_data("QOCI"); } + void QTBUG_6421(); private: // returns all database connections @@ -302,7 +304,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName( "more_results" ) << qTableName( "blobstest" ) << qTableName( "oraRowId" ) - << qTableName( "qtest_batch" ); + << qTableName( "qtest_batch" ) + << qTableName(QLatin1String("bug6421")).toUpper(); if ( db.driverName().startsWith("QPSQL") ) tablenames << qTableName("task_233829"); @@ -2935,5 +2938,28 @@ void tst_QSqlQuery::QTBUG_5251() } +void tst_QSqlQuery::QTBUG_6421() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + + QSqlQuery q(db); + QString tableName=qTableName(QLatin1String("bug6421")).toUpper(); + + QVERIFY_SQL(q, exec("create table "+tableName+"(COL1 char(10), COL2 char(10), COL3 char(10))")); + QVERIFY_SQL(q, exec("create index INDEX1 on "+tableName+" (COL1 desc)")); + QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)")); + QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)")); + q.setForwardOnly(true); + QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='"+tableName+"'")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\"")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toString(), QLatin1String("\"COL2\"")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\"")); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" |