diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:57:22 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:57:22 (GMT) |
commit | 3acb3c64cbdf538bde2299a0343e8ba250516901 (patch) | |
tree | 05392556f80735701a0b75065b9efb0795465ed0 | |
parent | 67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (diff) | |
parent | e5fcad302d86d316390c6b0f62759a067313e8a9 (diff) | |
download | Qt-3acb3c64cbdf538bde2299a0343e8ba250516901.zip Qt-3acb3c64cbdf538bde2299a0343e8ba250516901.tar.gz Qt-3acb3c64cbdf538bde2299a0343e8ba250516901.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
-rwxr-xr-x | configure | 7 | ||||
-rw-r--r-- | src/sql/drivers/db2/qsql_db2.cpp | 11 | ||||
-rw-r--r-- | src/sql/drivers/db2/qsql_db2.h | 2 | ||||
-rw-r--r-- | tests/auto/qreadwritelock/tst_qreadwritelock.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | 10 |
6 files changed, 29 insertions, 11 deletions
@@ -518,9 +518,14 @@ fi SYSTEM_VARIABLES="CC CXX CFLAGS CXXFLAGS LDFLAGS" for varname in $SYSTEM_VARIABLES; do + qmakevarname="${varname}" + # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS + if [ "${varname}" = "LDFLAGS" ]; then + qmakevarname="LFLAGS" + fi cmd=`echo \ 'if [ -n "\$'${varname}'" ]; then - QMakeVar set QMAKE_'${varname}' "\$'${varname}'" + QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}'" fi'` eval "$cmd" done diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 8e8bc56..69383f7 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -1594,4 +1594,15 @@ QVariant QDB2Driver::handle() const return QVariant(qRegisterMetaType<SQLHANDLE>("SQLHANDLE"), &d->hDbc); } +QString QDB2Driver::escapeIdentifier(const QString &identifier, IdentifierType) const +{ + QString res = identifier; + if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + res.replace(QLatin1Char('"'), QLatin1String("\"\"")); + res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + } + return res; +} + QT_END_NAMESPACE diff --git a/src/sql/drivers/db2/qsql_db2.h b/src/sql/drivers/db2/qsql_db2.h index fd1b702..6923027 100644 --- a/src/sql/drivers/db2/qsql_db2.h +++ b/src/sql/drivers/db2/qsql_db2.h @@ -110,6 +110,8 @@ public: const QString& host, int port, const QString& connOpts); + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + private: bool setAutoCommit(bool autoCommit); QDB2DriverPrivate* d; diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp index 3cb57dd..5b2a9a9 100644 --- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp @@ -943,10 +943,10 @@ void tst_QReadWriteLock::uncontendedLocks() } } - printf("during %d millisecs:\n", millisecs); - printf("counted to %u\n", count); - printf("%u uncontended read locks/unlocks\n", read); - printf("%u uncontended write locks/unlocks\n", write); + qDebug("during %d millisecs:", millisecs); + qDebug("counted to %u", count); + qDebug("%u uncontended read locks/unlocks", read); + qDebug("%u uncontended write locks/unlocks", write); } enum { RecursiveLockCount = 10 }; diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 25de429..349db65 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -307,7 +307,7 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) + db.driver()->escapeIdentifier(qTableName("qtest") + " test", QSqlDriver::TableName) + '(' + db.driver()->escapeIdentifier(QLatin1String("test test"), QSqlDriver::FieldName) - + " int primary key)"; + + " int not null primary key)"; QVERIFY_SQL(q, exec(qry)); } } diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 6736a44..63202f8 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -182,7 +182,7 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test3") + " values(0)"))); QVERIFY_SQL(q, prepare("insert into "+qTableName("test3")+"(id) select id + ? from "+qTableName("test3tmp"))); for (int i=1; i<260; i*=2) { - QVERIFY_SQL(q2, exec("delete from "+qTableName("test3tmp"))); + q2.exec("delete from "+qTableName("test3tmp")); QVERIFY_SQL(q2, exec("insert into "+qTableName("test3tmp")+"(id) select id from "+qTableName("test3"))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); @@ -191,7 +191,7 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) QVERIFY_SQL(q, exec(QString("insert into " + qTableName("many") + "(id, name) values (0, \'harry\')"))); QVERIFY_SQL(q, prepare("insert into "+qTableName("many")+"(id, name) select id + ?, name from "+qTableName("manytmp"))); for (int i=1; i < 2048; i*=2) { - QVERIFY_SQL(q2, exec("delete from "+qTableName("manytmp"))); + q2.exec("delete from "+qTableName("manytmp")); QVERIFY_SQL(q2, exec("insert into "+qTableName("manytmp")+"(id, name) select id, name from "+qTableName("many"))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); @@ -368,7 +368,7 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1); QCOMPARE(model.indexInQuery(model.index(0, 6)).column(), -1); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.record().field(0).name(), QString()); QCOMPARE(model.record().field(1).name(), isToUpper ? QString("ID") : QString("id")); QCOMPARE(model.record().field(2).name(), QString()); @@ -389,7 +389,7 @@ void tst_QSqlQueryModel::record() QSqlRecord rec = model.record(); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(rec.count(), 3); QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id")); @@ -433,7 +433,7 @@ void tst_QSqlQueryModel::setHeaderData() model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI"); + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), isToUpper ? QString("ID") : QString("id")); QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), isToUpper ? QString("NAME") : QString("name")); QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar")); |