summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:57:22 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:57:22 (GMT)
commit3acb3c64cbdf538bde2299a0343e8ba250516901 (patch)
tree05392556f80735701a0b75065b9efb0795465ed0 /src
parent67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (diff)
parente5fcad302d86d316390c6b0f62759a067313e8a9 (diff)
downloadQt-3acb3c64cbdf538bde2299a0343e8ba250516901.zip
Qt-3acb3c64cbdf538bde2299a0343e8ba250516901.tar.gz
Qt-3acb3c64cbdf538bde2299a0343e8ba250516901.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src')
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp11
-rw-r--r--src/sql/drivers/db2/qsql_db2.h2
2 files changed, 13 insertions, 0 deletions
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;