summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-08-27 00:59:08 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-08-27 00:59:08 (GMT)
commit843b53d2e9471310c956950606737e867888b0a1 (patch)
tree424e2ff41a49240555a9686b1d531adc43a45d0d
parent741bbc1be204adb4ceb6f9ae2aa35772c63d989c (diff)
parent40856f6e2e3b5115e8730ea86c97ed7211d4e5a3 (diff)
downloadQt-843b53d2e9471310c956950606737e867888b0a1.zip
Qt-843b53d2e9471310c956950606737e867888b0a1.tar.gz
Qt-843b53d2e9471310c956950606737e867888b0a1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp54
-rw-r--r--tests/auto/qsqldriver/tst_qsqldriver.cpp14
2 files changed, 33 insertions, 35 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 6a8609e..06ee3e1 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -743,37 +743,31 @@ void QODBCDriverPrivate::splitTableQualifier(const QString & qualifier, QString
QODBCDriverPrivate::DefaultCase QODBCDriverPrivate::defaultCase() const
{
- static bool isInitialized = false;
- static DefaultCase ret;
-
- if (!isInitialized) {
- SQLUSMALLINT casing;
- int r = SQLGetInfo(hDbc,
- SQL_IDENTIFIER_CASE,
- &casing,
- sizeof(casing),
- NULL);
- if ( r != SQL_SUCCESS)
- ret = Lower;//arbitrary case if driver cannot be queried
- else {
- switch (casing) {
- case (SQL_IC_UPPER):
- ret = Upper;
- break;
- case (SQL_IC_LOWER):
- ret = Lower;
- break;
- case (SQL_IC_SENSITIVE):
- ret = Sensitive;
- break;
- case (SQL_IC_MIXED):
- ret = Mixed;
- break;
- default:
- ret = Upper;
- }
+ DefaultCase ret;
+ SQLUSMALLINT casing;
+ int r = SQLGetInfo(hDbc,
+ SQL_IDENTIFIER_CASE,
+ &casing,
+ sizeof(casing),
+ NULL);
+ if ( r != SQL_SUCCESS)
+ ret = Mixed;//arbitrary case if driver cannot be queried
+ else {
+ switch (casing) {
+ case (SQL_IC_UPPER):
+ ret = Upper;
+ break;
+ case (SQL_IC_LOWER):
+ ret = Lower;
+ break;
+ case (SQL_IC_SENSITIVE):
+ ret = Sensitive;
+ break;
+ case (SQL_IC_MIXED):
+ default:
+ ret = Mixed;
+ break;
}
- isInitialized = true;
}
return ret;
}
diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp
index 5af56c7..4857295 100644
--- a/tests/auto/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp
@@ -144,9 +144,11 @@ void tst_QSqlDriver::record()
else if (db.driverName().startsWith("QPSQL"))
tablename = tablename.toLower();
- //check we can get records using a properly quoted table name
- rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName));
- QCOMPARE(rec.count(), 4);
+ if(!db.driverName().startsWith("QODBC") && !db.databaseName().contains("PostgreSql")) {
+ //check we can get records using a properly quoted table name
+ rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName));
+ QCOMPARE(rec.count(), 4);
+ }
for (int i = 0; i < fields.count(); ++i)
QCOMPARE(rec.fieldName(i), fields[i]);
@@ -188,8 +190,10 @@ void tst_QSqlDriver::primaryIndex()
else if (db.driverName().startsWith("QPSQL"))
tablename = tablename.toLower();
- index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName));
- QCOMPARE(index.count(), 1);
+ if(!db.driverName().startsWith("QODBC") && !db.databaseName().contains("PostgreSql")) {
+ index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName));
+ QCOMPARE(index.count(), 1);
+ }
if( db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"))
QCOMPARE(index.fieldName(0), QString::fromLatin1("ID"));
else