summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqlquery
diff options
context:
space:
mode:
authorBill King <bking@trolltech.com>2009-04-16 22:54:31 (GMT)
committerBill King <bking@trolltech.com>2009-04-16 23:09:40 (GMT)
commit90bc01d2854f5c7024027c6419ae22feff57aa71 (patch)
tree60149e6df41387f32cd67bccf0f465db3cb3ff01 /tests/auto/qsqlquery
parent90d7509e4a1543e43a49bfb25dd672d824c4fde3 (diff)
downloadQt-90bc01d2854f5c7024027c6419ae22feff57aa71.zip
Qt-90bc01d2854f5c7024027c6419ae22feff57aa71.tar.gz
Qt-90bc01d2854f5c7024027c6419ae22feff57aa71.tar.bz2
Fixes long strings getting truncated by the ODBC Driver.
This test has always been wrong/confusing. Fix it to work, and make sense. Task-number: 250026 Revby: Lincoln Ramsay
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 8d77589..074f16f 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -179,6 +179,10 @@ private slots:
void task_217003();
#endif
+ void task_250026_data() { generic_data("QODBC"); }
+ void task_250026();
+
+
private:
// returns all database connections
void generic_data(const QString &engine=QString());
@@ -293,6 +297,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
#ifdef NOT_READY_YET
tablenames << qTableName( "Planet" );
#endif
+ tablenames << qTableName( "task_250026" );
tst_Databases::safeDropTables( db, tablenames );
}
@@ -2677,5 +2682,34 @@ void tst_QSqlQuery::task_217003()
}
#endif
+void tst_QSqlQuery::task_250026()
+{
+ QString data258, data1026;
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ QSqlQuery q( db );
+
+ QString tableName = qTableName( "task_250026" );
+
+ if ( !q.exec( "create table " + tableName + " (longfield varchar(1100))" ) ) {
+ qDebug() << "Error" << q.lastError();
+ QSKIP( "Db doesn't support \"1100\" as a size for fields", SkipSingle );
+ }
+
+ data258.fill( 'A', 258 );
+ data1026.fill( 'A', 1026 );
+ QVERIFY_SQL( q, prepare( "insert into " + tableName + "(longfield) VALUES (:longfield)" ) );
+ q.bindValue( "longfield", data258 );
+ QVERIFY_SQL( q, exec() );
+ q.bindValue( "longfield", data1026 );
+ QVERIFY_SQL( q, exec() );
+ QVERIFY_SQL( q, exec( "select * from " + tableName ) );
+ QVERIFY_SQL( q, next() );
+ QCOMPARE( q.value( 0 ).toString().length(), data258.length() );
+ QVERIFY_SQL( q, next() );
+ QCOMPARE( q.value( 0 ).toString().length(), data1026.length() );
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"