summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2010-10-28 00:13:34 (GMT)
committerCharles Yin <charles.yin@nokia.com>2010-11-01 00:04:57 (GMT)
commit81fc8ec995a07909e59602b9281fbebfff4bd94c (patch)
tree08e4a6d96dd6ae839a884dcdc8a4df373edd3acd /tests/auto
parentf9d30be978f5f7f0ebf0b240064268037f01ebd5 (diff)
downloadQt-81fc8ec995a07909e59602b9281fbebfff4bd94c.zip
Qt-81fc8ec995a07909e59602b9281fbebfff4bd94c.tar.gz
Qt-81fc8ec995a07909e59602b9281fbebfff4bd94c.tar.bz2
Fix QTBUG-14640:oci performance problem with qlonglong
missing qlonglong switch case in bindValue(), so all qlonglong value fall back into QString, which makes the query slow. Change-Id: I7d8bf1c44ce3aaa15ee85be325a5c98dc3ed3ce1 Task-number:QTBUG-14640 Reviewed-by: Michael Goddard
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 7c93c7a..5367bd6 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -211,6 +211,8 @@ private slots:
void QTBUG_5765();
void QTBUG_14132_data() { generic_data("QOCI"); }
void QTBUG_14132();
+ void QTBUG_14640_data() { generic_data("QOCI"); }
+ void QTBUG_14640();
void sqlite_constraint_data() { generic_data("QSQLITE"); }
void sqlite_constraint();
@@ -329,7 +331,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "Planet", __FILE__ )
<< qTableName( "task_250026", __FILE__ )
<< qTableName( "task_234422", __FILE__ )
- << qTableName("test141895", __FILE__);
+ << qTableName("test141895", __FILE__)
+ << qTableName("qtest_QTBUG14640", __FILE__);
if ( db.driverName().startsWith("QPSQL") )
tablenames << qTableName("task_233829", __FILE__);
@@ -3101,6 +3104,32 @@ void tst_QSqlQuery::QTBUG_5765()
QCOMPARE(q.value(0).toInt(), 123);
}
+void tst_QSqlQuery::QTBUG_14640()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ const QString qtest_QTBUG14640(qTableName("qtest_QTBUG14640", __FILE__));
+
+ QSqlQuery q( db );
+ q.setForwardOnly( true );
+ QVERIFY_SQL( q, exec( "create table " + qtest_QTBUG14640 +
+ " (col1 number, col2 number)" ) );
+ QVERIFY_SQL( q, exec( "insert into " + qtest_QTBUG14640 + " values (1, 1111)" ) );
+ QVERIFY_SQL( q, exec( "insert into " + qtest_QTBUG14640 + " values (2, 2222)" ) );
+ QVERIFY_SQL( q, exec( "insert into " + qtest_QTBUG14640 + " values (3, 3333)" ) );
+
+ QString sqlStr = "select * from " + qtest_QTBUG14640 + " where col1 == :bindValue0 AND col2 == :bindValue1";
+ q.prepare(sqlStr);
+ q.bindValue(":bindValue0", qlonglong(1), QSql::In);
+ q.bindValue(":bindValue1", qlonglong(1111), QSql::In);
+ QVERIFY_SQL( q, exec() );
+
+ QVERIFY( q.next() );
+ QCOMPARE(q.boundValue( 0 ).toLongLong(), qlonglong(1));
+ QCOMPARE(q.boundValue( 1 ).toLongLong(), qlonglong(1111));
+}
+
void tst_QSqlQuery::sqlite_constraint()
{
QFETCH( QString, dbName );