summaryrefslogtreecommitdiffstats
path: root/tests/auto/q3sqlcursor
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-06-23 05:10:52 (GMT)
committerBill King <bill.king@nokia.com>2009-06-23 05:11:59 (GMT)
commit3647de5291db9e359e7844f80202251f47e83a97 (patch)
tree619b822e49e5c999b229b241605779c950521f0f /tests/auto/q3sqlcursor
parenta8eda447bbf87ebd4041c851022af389a0e388e0 (diff)
downloadQt-3647de5291db9e359e7844f80202251f47e83a97.zip
Qt-3647de5291db9e359e7844f80202251f47e83a97.tar.gz
Qt-3647de5291db9e359e7844f80202251f47e83a97.tar.bz2
Cleanup of db test cases.
Mostly cleanup of dropping of tables to a consistent place. Also enable itemmodel tests.
Diffstat (limited to 'tests/auto/q3sqlcursor')
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index a2f4a66..2d89639 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -132,6 +132,11 @@ 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"));
+ }
+
// 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,"
@@ -753,12 +758,12 @@ 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 = QString("CREATE TABLE %1 (id int, \"first Name\" varchar(20), "
- "lastName varchar(20))");
- QVERIFY_SQL(q, exec(query.arg(tableName)));
+ "lastName varchar(20))").arg(tableName);
+ QVERIFY_SQL(q, exec(query));
- Q3SqlCursor cur(QString("%1").arg(tableName), true, db);
+ Q3SqlCursor cur(tableName, true, db);
cur.select();
QSqlRecord *r = cur.primeInsert();
@@ -774,8 +779,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);
}