From 8915977e56b58c4631dfb2b8616585b664e55f38 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 6 Jul 2009 15:57:41 +1000 Subject: Fix more sql autotest failures. Sql server fails at numeric field calculations. (Confirmed by running against MySql via odbc). Also, quote fields properly. The drivers know how to do it correctly, so let them handle it. --- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 812c862..360c3b7 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -575,7 +575,7 @@ void tst_Q3SqlCursor::precision() if(!tst_Databases::isSqlServer(db)) QCOMPARE( cur.value( 0 ).asString(), precStr ); else - QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); + QCOMPARE( cur.value( 0 ).asString(), precStr.left(precStr.size()-1) ); // Sql server fails at counting. QVERIFY( cur.next() ); QCOMPARE( cur.value( 0 ).asDouble(), precDbl ); } @@ -759,8 +759,9 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { QSqlQuery q(db); q.exec(QString("DROP TABLE %1").arg(tableName)); - QString query = QString("CREATE TABLE %1 (id int, \"first Name\" varchar(20), " - "lastName varchar(20))"); + 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); -- cgit v0.12