diff options
Diffstat (limited to 'tests/auto/q3sqlcursor')
-rw-r--r-- | tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index f043248..951becb 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. @@ -21,9 +20,10 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. @@ -132,10 +132,12 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) if ( !db.isValid() ) return; QSqlQuery q( db ); + if (tst_Databases::isSqlServer(db)) { QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); } + // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," @@ -522,6 +524,9 @@ void tst_Q3SqlCursor::unicode() if ( !db.driver()->hasFeature( QSqlDriver::Unicode ) ) { QSKIP( "DBMS not Unicode capable", SkipSingle ); } + // ascii in the data storage, can't transliterate properly. invalid test. + if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) + QSKIP("Can't transliterate extended unicode to ascii", SkipSingle); Q3SqlCursor cur( qTableName( "qtest_unicode" ), true, db ); QSqlRecord* irec = cur.primeInsert(); @@ -572,10 +577,7 @@ void tst_Q3SqlCursor::precision() QVERIFY_SQL(cur, select()); QVERIFY( cur.next() ); - if(!tst_Databases::isSqlServer(db)) - QCOMPARE( cur.value( 0 ).asString(), precStr ); - else - QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); // Sql server fails at counting. + QCOMPARE( cur.value( 0 ).asString(), precStr ); QVERIFY( cur.next() ); QCOMPARE( cur.value( 0 ).asDouble(), precDbl ); } @@ -760,13 +762,13 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { QString tableName = qTableName("qtestws"); QSqlQuery q(db); - q.exec(QString("DROP TABLE %1").arg(tableName)); + tst_Databases::safeDropTable(db, tableName); QString query = "CREATE TABLE %1 (id int, " + db.driver()->escapeIdentifier("first Name", QSqlDriver::FieldName) + " varchar(20), lastName varchar(20))"; QVERIFY_SQL(q, exec(query.arg(tableName))); - Q3SqlCursor cur(QString("%1").arg(tableName), true, db); + Q3SqlCursor cur(tableName, true, db); cur.select(); QSqlRecord *r = cur.primeInsert(); @@ -782,8 +784,8 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { QVERIFY(cur.value(0) == 1); QCOMPARE(cur.value(1).toString(), QString("Kong")); QCOMPARE(cur.value(2).toString(), QString("Harald")); - - q.exec(QString("DROP TABLE %1").arg(tableName)); + + tst_Databases::safeDropTable(db, tableName); } |